diff --git a/src/platforms/app-plus/page-factory.js b/src/platforms/app-plus/page-factory.js index 029776525bd51e3299acf2c1d3fe978c42d83008..753919afe5591879e63b28553de183dd20caceaa 100644 --- a/src/platforms/app-plus/page-factory.js +++ b/src/platforms/app-plus/page-factory.js @@ -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 } diff --git a/src/platforms/app-plus/service/api/route/util.js b/src/platforms/app-plus/service/api/route/util.js index ec7f38a614e64e63ededb46ce98467b6451b1090..c02644ebc99deacf79d8fbf5aa42d44b40aa23e4 100644 --- a/src/platforms/app-plus/service/api/route/util.js +++ b/src/platforms/app-plus/service/api/route/util.js @@ -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) diff --git a/src/platforms/app-plus/service/framework/page.js b/src/platforms/app-plus/service/framework/page.js index 0bc446f2c8f42bf1037a55ea4746d1ef9b340855..a2f3916ef1dc63a868673b306ff9f3af587a7bbe 100644 --- a/src/platforms/app-plus/service/framework/page.js +++ b/src/platforms/app-plus/service/framework/page.js @@ -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 -} +}