Skip to content

Commit

Permalink
fix(runtime): 修复 onReady 偶现不触发的问题,fix #12424
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Jan 17, 2023
1 parent cca7de6 commit 4f8658f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/taro-runtime/src/dsl/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ export function createPageConfig (component: any, pageName?: string, data?: Reco
})
},
[ONREADY] () {
// 触发生命周期
safeExecute(this.$taroPath, ON_READY)
// 通过事件触发子组件的生命周期
raf(() => eventCenter.trigger(getOnReadyEventKey(id)))
this.onReady.called = true
hasLoaded.then(() => {
// 触发生命周期
safeExecute(this.$taroPath, ON_READY)
// 通过事件触发子组件的生命周期
raf(() => eventCenter.trigger(getOnReadyEventKey(id)))
this.onReady.called = true
})
},
[ONSHOW] (options = {}) {
hasLoaded.then(() => {
Expand Down

0 comments on commit 4f8658f

Please sign in to comment.