提交 020faa4e 编写于 作者: L liuxiaohang 提交者: qiang

fix(mp-toutiao): 修复 字节小程序$emit不触发 fixed #2774

# Conflicts:
#	packages/uni-mp-toutiao/dist/index.js
上级 58ff9525
......@@ -1091,7 +1091,11 @@ function initTriggerEvent (mpInstance) {
};
}
function initHook (name, options) {
function initHook (name, options, isComponent) {
{
// fix by Lxh 字节自定义组件Component构造器文档上写有created,但是实测只触发了lifetimes上的created
isComponent && (options = options.lifetimes);
}
const oldHook = options[name];
if (!oldHook) {
options[name] = function () {
......@@ -1113,7 +1117,7 @@ if (!MPPage.__$wrappered) {
Page.after = MPPage.after;
Component = function (options = {}) {
initHook('created', options);
initHook('created', options, true);
return MPComponent(options)
};
}
......
......@@ -24,7 +24,11 @@ function initTriggerEvent (mpInstance) {
}
}
function initHook (name, options) {
function initHook (name, options, isComponent) {
if (__PLATFORM__ === 'mp-toutiao') {
// fix by Lxh 字节自定义组件Component构造器文档上写有created,但是实测只触发了lifetimes上的created
isComponent && (options = options.lifetimes)
}
const oldHook = options[name]
if (!oldHook) {
options[name] = function () {
......@@ -46,7 +50,7 @@ if (!MPPage.__$wrappered) {
Page.after = MPPage.after
Component = function (options = {}) {
initHook('created', options)
initHook('created', options, true)
return MPComponent(options)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册