diff --git a/src/utils/cache.js b/src/utils/cache.js index 87cc48fa3e0..80d053d6105 100644 --- a/src/utils/cache.js +++ b/src/utils/cache.js @@ -1,4 +1,4 @@ -import { Vue } from '../vue' +import { Vue, isVue3 } from '../vue' import { cloneDeep } from './clone-deep' import { looseEqual } from './loose-equal' import { hasOwnProperty, keys } from './object' @@ -16,11 +16,19 @@ export const makePropWatcher = propName => ({ } for (const key in oldValue) { if (!hasOwnProperty(newValue, key)) { - this.$delete(this.$data[propName], key) + if (isVue3) { + delete this.$data[propName][key] + } else { + this.$delete(this.$data[propName], key) + } } } for (const key in newValue) { - this.$set(this.$data[propName], key, newValue[key]) + if (isVue3) { + this.$data[propName][key] = newValue[key] + } else { + this.$set(this.$data[propName], key, newValue[key]) + } } } })