提交 1429909d 编写于 作者: fxy060608's avatar fxy060608

fix(v3): show.callback

上级 bdb8b7d2
......@@ -21,11 +21,11 @@ export function createPage (pagePath, pageId, pageQuery, pageInstance) {
mpType: 'page',
pageId,
pagePath,
pageQuery,
pageQuery,
pageInstance
})
if (process.env.NODE_ENV !== 'production') {
console.log(`new ${pagePath}`, Date.now() - startTime)
console.log(`new ${pagePath}[${pageId}]:time(${Date.now() - startTime})`)
}
return pageVm
}
......@@ -7,7 +7,7 @@ import {
navigateFinish
} from '../../framework/navigator'
export function showWebview (webview, animationType, animationDuration, showCallback, delay) {
export function showWebview (webview, animationType, animationDuration, showCallback, delay) {
if (typeof delay === 'undefined') {
delay = webview.nvue ? 0 : 100
}
......@@ -21,16 +21,36 @@ export function showWebview (webview, animationType, animationDuration, showCall
if (process.env.NODE_ENV !== 'production') {
console.log(`[show][${Date.now()}]`, delay)
}
const duration = animationDuration || ANI_DURATION
setTimeout(() => {
const execShowCallback = function () {
if (execShowCallback._called) {
if (process.env.NODE_ENV !== 'production') {
console.log('execShowCallback.prevent')
}
return
}
execShowCallback._called = true
showCallback && showCallback()
navigateFinish(webview)
}
const timer = setTimeout(() => {
if (process.env.NODE_ENV !== 'production') {
console.log(`[show.callback.timer][${Date.now()}]`)
}
execShowCallback()
}, duration + 150)
webview.show(
animationType || ANI_SHOW,
animationDuration || ANI_DURATION,
duration,
() => {
if (process.env.NODE_ENV !== 'production') {
console.log(`[show.callback][${Date.now()}]`)
}
showCallback && showCallback()
navigateFinish(webview)
if (!execShowCallback._called) {
clearTimeout(timer)
}
execShowCallback()
}
)
}, delay)
......
......@@ -93,7 +93,7 @@ export function registerPage ({
}
pages.splice(index, 1)
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] removePage', path, webview.id)
console.log('[uni-app] removePage(' + path + ')[' + webview.id + ']')
}
}
},
......@@ -134,4 +134,4 @@ export function registerPage ({
}
return webview
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册