Skip to content

Commit 3808529

Browse files
committed
chore(compat): remove this.$set usage in vue3 version of cache
1 parent f0a31a4 commit 3808529

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/utils/cache.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Vue } from '../vue'
1+
import { Vue, isVue3 } from '../vue'
22
import { cloneDeep } from './clone-deep'
33
import { looseEqual } from './loose-equal'
44
import { hasOwnProperty, keys } from './object'
@@ -16,11 +16,19 @@ export const makePropWatcher = propName => ({
1616
}
1717
for (const key in oldValue) {
1818
if (!hasOwnProperty(newValue, key)) {
19-
this.$delete(this.$data[propName], key)
19+
if (isVue3) {
20+
delete this.$data[propName][key]
21+
} else {
22+
this.$delete(this.$data[propName], key)
23+
}
2024
}
2125
}
2226
for (const key in newValue) {
23-
this.$set(this.$data[propName], key, newValue[key])
27+
if (isVue3) {
28+
this.$data[propName][key] = newValue[key]
29+
} else {
30+
this.$set(this.$data[propName], key, newValue[key])
31+
}
2432
}
2533
}
2634
})

0 commit comments

Comments
 (0)