提交 777bd4e6 编写于 作者: fxy060608's avatar fxy060608

fix(h5): $ownerInstance

上级 d6d1a649
......@@ -32,7 +32,7 @@ function genRenderjsCode(name: string) {
if(!Comp.$renderjs){Comp.$renderjs = []}
Comp.$renderjs.push('${name}')
if(!Comp.mixins){Comp.mixins = []}
Comp.mixins.push({beforeCreate(){ this['${name}'] = this }})
Comp.mixins.push({beforeCreate(){ this['${name}'] = this },mounted(){ this.$ownerInstance = this.$gcd(this, true) }})
Comp.mixins.push(_sfc_renderjs)
}`
}
......
......@@ -13435,11 +13435,11 @@ function addSubscribe(name, callback, pageId) {
callback(type, data, resolve);
});
}
function removeSubscribe(name) {
function removeSubscribe(name, pageId) {
if (!name) {
return;
}
unregisterViewMethod(getCurrentPageId(), name);
unregisterViewMethod(pageId || getCurrentPageId(), name);
}
function useSubscribe(callback, name, multiple, pageId) {
const instance2 = getCurrentInstance();
......@@ -13454,7 +13454,7 @@ function useSubscribe(callback, name, multiple, pageId) {
}
});
onBeforeUnmount(() => {
removeSubscribe(name || normalizeEvent(vm));
removeSubscribe(name || normalizeEvent(vm), pageId);
});
}
function useOn(name, callback) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册