From 9043d0dca72439064e479742da55b46deae82b42 Mon Sep 17 00:00:00 2001 From: zhangenming <282126346@qq.com> Date: Tue, 24 Aug 2021 06:32:58 +0800 Subject: [PATCH] refactor(reactivity): use explicit assignments. (#4401) --- packages/reactivity/src/ref.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index 0747f8e13..11bc4d352 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -79,7 +79,7 @@ export function ref(value: T): ToRef export function ref(value: T): Ref> export function ref(): Ref export function ref(value?: unknown) { - return createRef(value) + return createRef(value, false) } export function shallowRef( @@ -98,7 +98,7 @@ class RefImpl { public dep?: Dep = undefined public readonly __v_isRef = true - constructor(value: T, public readonly _shallow = false) { + constructor(value: T, public readonly _shallow: boolean) { this._rawValue = _shallow ? value : toRaw(value) this._value = _shallow ? value : convert(value) } @@ -118,7 +118,7 @@ class RefImpl { } } -function createRef(rawValue: unknown, shallow = false) { +function createRef(rawValue: unknown, shallow: boolean) { if (isRef(rawValue)) { return rawValue }