diff --git a/packages/mpvue/index.js b/packages/mpvue/index.js index 84dff876..5ad72e70 100644 --- a/packages/mpvue/index.js +++ b/packages/mpvue/index.js @@ -2179,7 +2179,7 @@ function mountComponent ( vm.$el = el; if (!vm.$options.render) { vm.$options.render = createEmptyVNode; - + } callHook(vm, 'beforeMount'); @@ -2274,7 +2274,7 @@ function updateChildComponent ( vm.$forceUpdate(); } - + } function isInInactiveTree (vm) { @@ -2885,7 +2885,7 @@ function initMethods (vm, methods) { var props = vm.$options.props; for (var key in methods) { vm[key] = methods[key] == null ? noop : bind(methods[key], vm); - + } } @@ -5669,6 +5669,11 @@ function updateDataToMP () { return } + // 对于被销毁的节点,不更新data + if (this._isDestroyed) { + return + } + var data = formatVmData(this); diffData(this, data); throttleSetData(page.setData.bind(page), data); diff --git a/src/platforms/mp/runtime/render.js b/src/platforms/mp/runtime/render.js index 6faac058..0d6ef7d5 100644 --- a/src/platforms/mp/runtime/render.js +++ b/src/platforms/mp/runtime/render.js @@ -142,6 +142,11 @@ export function updateDataToMP () { return } + // 对于被销毁的节点,不更新data + if (this._isDestroyed) { + return + } + const data = formatVmData(this) diffData(this, data) throttleSetData(page.setData.bind(page), data)