提交 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 => {
if (eventList.includes(key)) {
const handler = refProps[key];
const res = key.match(/^on([A-Z])(\S*)/);
if (res && typeof handler === 'function' && handler.name === 'bound handleEvent') {
const event = res && (res[1].toLowerCase() + res[2]);
refProps[key] = eventProps[key] = function () {
const props = Object.assign({}, refProps);
......@@ -2583,6 +2584,22 @@ const handleLink$1 = (function () {
}
})();
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', {
get () {
......@@ -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
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册