Skip to content

Commit

Permalink
fix(runtime): 修复 Vue3 首次进入页面会触发两次 onShow 的问题,fix #10728
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Dec 13, 2021
1 parent 97f7e2c commit 280b7b8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/taro-runtime/src/dsl/vue3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isFunction, isArray, ensure } from '@tarojs/shared'
import container from '../container'
import SERVICE_IDENTIFIER from '../constants/identifiers'
import { Current } from '../current'
import { injectPageInstance, safeExecute } from './common'
import { injectPageInstance } from './common'
import { isBrowser } from '../env'

import type {
Expand All @@ -25,10 +25,6 @@ function createVue3Page (h: typeof createElement, id: string) {
},
created () {
injectPageInstance(this, id)
// vue3 组件 created 时机比小程序页面 onShow 慢,因此在 created 后再手动触发一次 onShow。
this.$nextTick(() => {
safeExecute(id, 'onShow')
})
}
}

Expand Down

0 comments on commit 280b7b8

Please sign in to comment.