From: zhangenming <282126346@qq.com> Date: Mon, 23 Aug 2021 22:32:58 +0000 (+0800) Subject: refactor(reactivity): use explicit assignments. (#4401) X-Git-Tag: v3.2.5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9043d0dca72439064e479742da55b46deae82b42;p=thirdparty%2Fvuejs%2Fcore.git refactor(reactivity): use explicit assignments. (#4401) --- diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index 0747f8e131..11bc4d3529 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 }