refactor: better variable naming
This commit is contained in:
parent
066ba82c7f
commit
e43f5935b5
@ -28,19 +28,19 @@ export function isRef(r: any): r is Ref {
|
|||||||
return r ? r._isRef === true : false
|
return r ? r._isRef === true : false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ref<T extends Ref>(raw: T): T
|
export function ref<T extends Ref>(value: T): T
|
||||||
export function ref<T>(raw: T): Ref<T>
|
export function ref<T>(value: T): Ref<T>
|
||||||
export function ref<T = any>(): Ref<T>
|
export function ref<T = any>(): Ref<T>
|
||||||
export function ref(raw?: unknown) {
|
export function ref(value?: unknown) {
|
||||||
if (isRef(raw)) {
|
if (isRef(value)) {
|
||||||
return raw
|
return value
|
||||||
}
|
}
|
||||||
raw = convert(raw)
|
value = convert(value)
|
||||||
|
|
||||||
if (__SSR__) {
|
if (__SSR__) {
|
||||||
return {
|
return {
|
||||||
_isRef: true,
|
_isRef: true,
|
||||||
value: raw
|
value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ export function ref(raw?: unknown) {
|
|||||||
_isRef: true,
|
_isRef: true,
|
||||||
get value() {
|
get value() {
|
||||||
track(r, TrackOpTypes.GET, 'value')
|
track(r, TrackOpTypes.GET, 'value')
|
||||||
return raw
|
return value
|
||||||
},
|
},
|
||||||
set value(newVal) {
|
set value(newVal) {
|
||||||
raw = convert(newVal)
|
value = convert(newVal)
|
||||||
trigger(
|
trigger(
|
||||||
r,
|
r,
|
||||||
TriggerOpTypes.SET,
|
TriggerOpTypes.SET,
|
||||||
|
Loading…
Reference in New Issue
Block a user