Navigation Menu

Skip to content

Commit

Permalink
fix: detect property add/deletion on reactive objects from setup when…
Browse files Browse the repository at this point in the history
… used in templates
  • Loading branch information
yyx990803 committed Jul 12, 2022
1 parent 98fb01c commit a6e7498
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/v3/reactivity/ref.ts
Expand Up @@ -119,7 +119,16 @@ export function proxyWithRefUnwrap(
Object.defineProperty(target, key, {
enumerable: true,
configurable: true,
get: () => unref(source[key]),
get: () => {
const val = source[key]
if (isRef(val)) {
return val.value
} else {
const ob = val && val.__ob__
if (ob) ob.dep.depend()
return val
}
},
set: value => {
const oldValue = source[key]
if (isRef(oldValue) && !isRef(value)) {
Expand Down

0 comments on commit a6e7498

Please sign in to comment.