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

fix(v3): show.callback

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