From a25f90ada3aefcd49b2c0fcd8c3ae3bbe1d4db72 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Thu, 2 Dec 2021 15:27:11 +0800 Subject: [PATCH] fix(mp): v-model support dynamic add reactive properties --- .../packages/mp-vue/dist/mp.runtime.esm.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js b/packages/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js index 7c8bc3c15..61b63e036 100644 --- a/packages/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js +++ b/packages/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js @@ -4087,10 +4087,10 @@ function updateChildComponent ( // keep a copy of raw propsData vm.$options.propsData = propsData; } - + // fixed by xxxxxx update properties(mp runtime) vm._$updateProperties && vm._$updateProperties(vm); - + // update listeners listeners = listeners || emptyObject; var oldListeners = vm.$options._parentListeners; @@ -4621,7 +4621,7 @@ function initProps (vm, propsOptions) { } //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警 if( - key === 'value' && + key === 'value' && Array.isArray(vm.$options.behaviors) && vm.$options.behaviors.indexOf('uni://form-field') !== -1 ){ @@ -4633,7 +4633,7 @@ function initProps (vm, propsOptions) { var $parent = vm.$parent; while($parent){ if($parent.__next_tick_pending){ - return + return } $parent = $parent.$parent; } @@ -4965,10 +4965,10 @@ function initMixin (Vue) { initEvents(vm); initRender(vm); callHook(vm, 'beforeCreate'); - !vm._$fallback && initInjections(vm); // resolve injections before data/props + !vm._$fallback && initInjections(vm); // resolve injections before data/props initState(vm); !vm._$fallback && initProvide(vm); // resolve provide after data/props - !vm._$fallback && callHook(vm, 'created'); + !vm._$fallback && callHook(vm, 'created'); /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { @@ -5694,7 +5694,7 @@ function mountComponent$1( } } } - + !vm._$fallback && callHook(vm, 'beforeMount'); var updateComponent = function () { @@ -5893,14 +5893,16 @@ function internalMixin(Vue) { if (!target) { target = this; } - target[key] = value; + // 解决动态属性添加 + Vue.set(target, key, value) }; Vue.prototype.__set_sync = function(target, key, value) { if (!target) { target = this; } - target[key] = value; + // 解决动态属性添加 + Vue.set(target, key, value) }; Vue.prototype.__get_orig = function(item) { @@ -6033,7 +6035,7 @@ Vue.prototype.__patch__ = patch; // public mount method Vue.prototype.$mount = function( el , - hydrating + hydrating ) { return mountComponent$1(this, el, hydrating) }; -- GitLab