From b47f7fae51a790d9c1a88993d682ec356d0d2a01 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 20 Aug 2019 14:32:11 +0800 Subject: [PATCH] fix(mp-weixin): intercept mutating methods (Array) #691 #694 --- .../packages/mp-vue/dist/mp.runtime.esm.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 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 eb78ea38c..281178e6e 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 @@ -910,7 +910,13 @@ var Observer = function Observer (value) { def(value, '__ob__', this); if (Array.isArray(value)) { if (hasProto) { - protoAugment(value, arrayMethods); + {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑 + if(value.push !== value.__proto__.push){ + copyAugment(value, arrayMethods, arrayKeys); + } else { + protoAugment(value, arrayMethods); + } + } } else { copyAugment(value, arrayMethods, arrayKeys); } @@ -2479,7 +2485,12 @@ function resolveSlots ( slot.push(child); } } else { - (slots.default || (slots.default = [])).push(child); + // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page + if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){ + (slots['page'] || (slots['page'] = [])).push(child); + }else{ + (slots.default || (slots.default = [])).push(child); + } } } // ignore slots that contains only whitespace -- GitLab