提交 f7130646 编写于 作者: Q qiang

chore: build mp

上级 89208a28
......@@ -2478,11 +2478,12 @@ function handleRef (ref) {
if (ref.props['data-com-type'] === 'wx') {
const eventProps = {};
let refProps = ref.props;
const eventList = refProps['data-event-list'].split(',');
// 初始化支付宝小程序组件事件
Object.keys(refProps).forEach(key => {
const handler = refProps[key];
const res = key.match(/^on([A-Z])(\S*)/);
if (res && typeof handler === 'function' && handler.name === 'bound handleEvent') {
if (eventList.includes(key)) {
const handler = refProps[key];
const res = key.match(/^on([A-Z])(\S*)/);
const event = res && (res[1].toLowerCase() + res[2]);
refProps[key] = eventProps[key] = function () {
const props = Object.assign({}, refProps);
......@@ -2581,7 +2582,23 @@ const handleLink$1 = (function () {
// 支付宝通过 didMount 来实现,先子后父,故等父 ready 之后,统一初始化
(this._$childVues || (this._$childVues = [])).unshift(detail);
}
})();
})();
const handleWrap = function (mp, destory) {
const vueId = mp.props.vueId;
const list = mp.props['data-event-list'].split(',');
list.forEach(eventName => {
const key = `${eventName}${vueId}`;
if (destory) {
delete this[key];
} else {
// TODO remove handleRef
this[key] = function () {
mp.props[eventName].apply(this, arguments);
};
}
});
};
function parseApp (vm) {
Object.defineProperty(Vue.prototype, '$slots', {
......@@ -2744,6 +2761,7 @@ function parsePage (vuePageOptions) {
__r: handleRef,
__e: handleEvent,
__l: handleLink$1,
__w: handleWrap,
triggerEvent
};
......@@ -2860,6 +2878,7 @@ function parseComponent (vueComponentOptions) {
__r: handleRef,
__e: handleEvent,
__l: handleLink$1,
__w: handleWrap,
triggerEvent
}
};
......@@ -2871,14 +2890,14 @@ function parseComponent (vueComponentOptions) {
componentOptions.deriveDataFromProps = createObserver$1();
} else {
componentOptions.didUpdate = createObserver$1(true);
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
componentOptions.methods[callMethod] = function (args) {
return this.$vm[callMethod](args)
};
});
}
if (Array.isArray(vueOptions.wxsCallMethods)) {
vueOptions.wxsCallMethods.forEach(callMethod => {
componentOptions.methods[callMethod] = function (args) {
return this.$vm[callMethod](args)
};
});
}
return componentOptions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册