From 03de6b76dd288b70a7854809891e1cf0ffd0ee6b Mon Sep 17 00:00:00 2001 From: Danny Date: Sat, 7 Mar 2020 23:09:17 +0800 Subject: [PATCH] mp-weixin: Fix Component don't inherit props from Vue.extend(). Support externalClasses option. Fix inheritance issue by using Vue.options instead of Vue.extendOptions. Add externalClasses to wechat MP component options. --- .../mp-weixin/runtime/wrapper/component-base-parser.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/platforms/mp-weixin/runtime/wrapper/component-base-parser.js b/src/platforms/mp-weixin/runtime/wrapper/component-base-parser.js index e560022d58..6fb1e5d4a4 100644 --- a/src/platforms/mp-weixin/runtime/wrapper/component-base-parser.js +++ b/src/platforms/mp-weixin/runtime/wrapper/component-base-parser.js @@ -20,13 +20,14 @@ export default function parseBaseComponent (vueComponentOptions, { initRelation } = {}) { let [VueComponent, vueOptions] = initVueComponent(Vue, vueComponentOptions) + vueOptions = VueComponent.options || vueOptions const options = { multipleSlots: true, addGlobalClass: true } - if (__PLATFORM__ === 'mp-weixin' || __PLATFORM__ === 'mp-qq') { + if (__PLATFORM__ === 'mp-weixin' || __PLATFORM__ === 'mp-qq') { // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项 if (vueOptions['mp-weixin'] && vueOptions['mp-weixin']['options']) { Object.assign(options, vueOptions['mp-weixin']['options']) @@ -96,6 +97,10 @@ export default function parseBaseComponent (vueComponentOptions, { __e: handleEvent } } + // externalClasses + if (vueOptions.externalClasses) { + componentOptions.externalClasses = vueOptions.externalClasses + } if (Array.isArray(vueOptions.wxsCallMethods)) { vueOptions.wxsCallMethods.forEach(callMethod => { @@ -109,4 +114,4 @@ export default function parseBaseComponent (vueComponentOptions, { return componentOptions } return [componentOptions, VueComponent] -} +} -- GitLab