feat(reactivity): provide correct tracking info for refs
This commit is contained in:
parent
7f054782ad
commit
f3c1fa75f6
@ -24,12 +24,17 @@ export function ref(raw?: unknown) {
|
||||
const r = {
|
||||
_isRef: true,
|
||||
get value() {
|
||||
track(r, OperationTypes.GET, '')
|
||||
track(r, OperationTypes.GET, 'value')
|
||||
return raw
|
||||
},
|
||||
set value(newVal) {
|
||||
raw = convert(newVal)
|
||||
trigger(r, OperationTypes.SET, '')
|
||||
trigger(
|
||||
r,
|
||||
OperationTypes.SET,
|
||||
'value',
|
||||
__DEV__ ? { newValue: newVal } : void 0
|
||||
)
|
||||
}
|
||||
}
|
||||
return r as Ref
|
||||
|
Loading…
Reference in New Issue
Block a user