diff --git a/packages/shims-vue-runtime.d.ts b/packages/shims-vue-runtime.d.ts index 012c97780589df2dc2b1b4af5937a6e3a50a5344..14eb058fafa390824fdec1e616d271babca8c32d 100644 --- a/packages/shims-vue-runtime.d.ts +++ b/packages/shims-vue-runtime.d.ts @@ -12,7 +12,6 @@ declare module '@vue/runtime-core' { $page: Page.PageInstance['$page'] $mpType?: 'app' | 'page' $locale?: string - __isTabBar: boolean } type LifecycleHook = Function[] | null @@ -24,6 +23,7 @@ declare module '@vue/runtime-core' { __isUnload: boolean __isVisible: boolean __isActive?: boolean // tabBar + __isTabBar?: boolean // h5 | app $wxsModules?: string[] } diff --git a/packages/uni-app-plus/dist/uni-app-service.es.js b/packages/uni-app-plus/dist/uni-app-service.es.js index a653971915748411530407bbba31da5ded9ba20c..40cc3d392f2c3c3b6a4d36cb3fc65cebcf8ed694 100644 --- a/packages/uni-app-plus/dist/uni-app-service.es.js +++ b/packages/uni-app-plus/dist/uni-app-service.es.js @@ -2285,7 +2285,7 @@ var serviceContext = (function (vue) { pageVm.$page = page; pageVm.$mpType = 'page'; if (page.meta.isTabBar) { - pageVm.__isTabBar = true; + pageVm.$.__isTabBar = true; // TODO preload? 初始化时,状态肯定是激活 pageVm.$.__isActive = true; } @@ -10394,7 +10394,7 @@ var serviceContext = (function (vue) { function getCurrentPages$1() { const curPages = []; pages.forEach((page) => { - if (page.__isTabBar) { + if (page.$.__isTabBar) { if (page.$.__isActive) { curPages.push(page); } @@ -11834,14 +11834,14 @@ var serviceContext = (function (vue) { if (len >= 1) { // 前一个页面是非 tabBar 页面 currentPage = pages[len - 1]; - if (currentPage && !currentPage.__isTabBar) { + if (currentPage && !currentPage.$.__isTabBar) { // 前一个页面为非 tabBar 页面时,目标tabBar需要强制触发onShow // 该情况下目标页tabBarPage的visible是不对的 // 除非每次路由跳转都处理一遍tabBarPage的visible,目前仅switchTab会处理 // 简单起见,暂时直接判断该情况,执行onShow callOnShow = true; pages.reverse().forEach((page) => { - if (!page.__isTabBar && page !== currentPage) { + if (!page.$.__isTabBar && page !== currentPage) { closePage(page, 'none'); } }); @@ -11872,7 +11872,7 @@ var serviceContext = (function (vue) { tabBarPage = page; } else { - if (page.__isTabBar) { + if (page.$.__isTabBar) { page.$.__isActive = false; } } diff --git a/packages/uni-app-plus/src/service/api/route/switchTab.ts b/packages/uni-app-plus/src/service/api/route/switchTab.ts index 9a15f4bad5fd547d26299b6abfee4601a1ba248c..248bd8fe4a8360c4e5624498314b74ec6ae80643 100644 --- a/packages/uni-app-plus/src/service/api/route/switchTab.ts +++ b/packages/uni-app-plus/src/service/api/route/switchTab.ts @@ -61,14 +61,14 @@ function _switchTab({ if (len >= 1) { // 前一个页面是非 tabBar 页面 currentPage = pages[len - 1]! as ComponentPublicInstance - if (currentPage && !currentPage.__isTabBar) { + if (currentPage && !currentPage.$.__isTabBar) { // 前一个页面为非 tabBar 页面时,目标tabBar需要强制触发onShow // 该情况下目标页tabBarPage的visible是不对的 // 除非每次路由跳转都处理一遍tabBarPage的visible,目前仅switchTab会处理 // 简单起见,暂时直接判断该情况,执行onShow callOnShow = true pages.reverse().forEach((page) => { - if (!page.__isTabBar && page !== currentPage) { + if (!page.$.__isTabBar && page !== currentPage) { closePage(page, 'none') } }) @@ -97,7 +97,7 @@ function _switchTab({ page.$.__isActive = true tabBarPage = page } else { - if (page.__isTabBar) { + if (page.$.__isTabBar) { page.$.__isActive = false } } diff --git a/packages/uni-app-plus/src/service/framework/page/getCurrentPages.ts b/packages/uni-app-plus/src/service/framework/page/getCurrentPages.ts index 0b5b4e7990fac196a5b3450aea497367bc901119..620d47458245699eaa390a168f145b2ee8292041 100644 --- a/packages/uni-app-plus/src/service/framework/page/getCurrentPages.ts +++ b/packages/uni-app-plus/src/service/framework/page/getCurrentPages.ts @@ -20,7 +20,7 @@ export function getAllPages() { export function getCurrentPages() { const curPages: ComponentPublicInstance[] = [] pages.forEach((page) => { - if (page.__isTabBar) { + if (page.$.__isTabBar) { if (page.$.__isActive) { curPages.push(page) } diff --git a/packages/uni-core/src/service/init/index.ts b/packages/uni-core/src/service/init/index.ts index 94cad00bfd0fc7ed82dc8ef7e87e403017224465..69c772a20b25ef78636ffa795353a94129a121c5 100644 --- a/packages/uni-core/src/service/init/index.ts +++ b/packages/uni-core/src/service/init/index.ts @@ -41,7 +41,7 @@ export function initPageVm( pageVm.$page = page pageVm.$mpType = 'page' if (page.meta.isTabBar) { - pageVm.__isTabBar = true + pageVm.$.__isTabBar = true // TODO preload? 初始化时,状态肯定是激活 pageVm.$.__isActive = true } diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index f99f233b5f25f6bfc34436e2df416aff7f89120c..a93e672dd66f8f503570787a874589a37060ce5a 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -479,7 +479,7 @@ function initPageVm(pageVm, page) { pageVm.$page = page; pageVm.$mpType = "page"; if (page.meta.isTabBar) { - pageVm.__isTabBar = true; + pageVm.$.__isTabBar = true; pageVm.$.__isActive = true; } } @@ -6741,7 +6741,7 @@ function getCurrentPages$1() { const curPages = []; const pages = currentPagesMap.values(); for (const page of pages) { - if (page.__isTabBar) { + if (page.$.__isTabBar) { if (page.$.__isActive) { curPages.push(page); } diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index 0f045ad9dbd260039c0ee4e31498f8e46fd07464..194645802d2cf46b32e534b5a8214a7b4f8b8e92 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -1449,7 +1449,7 @@ function initPageVm(pageVm, page) { pageVm.$page = page; pageVm.$mpType = "page"; if (page.meta.isTabBar) { - pageVm.__isTabBar = true; + pageVm.$.__isTabBar = true; pageVm.$.__isActive = true; } } @@ -13640,7 +13640,7 @@ function getCurrentPages$1() { const curPages = []; const pages = currentPagesMap.values(); for (const page of pages) { - if (page.__isTabBar) { + if (page.$.__isTabBar) { if (page.$.__isActive) { curPages.push(page); } @@ -18215,13 +18215,13 @@ function removeNonTabBarPages() { const keys = pagesMap.keys(); for (const routeKey of keys) { const page = pagesMap.get(routeKey); - if (!page.__isTabBar) { + if (!page.$.__isTabBar) { removePage(routeKey); } else { page.$.__isActive = false; } } - if (curTabBarPageVm.__isTabBar) { + if (curTabBarPageVm.$.__isTabBar) { curTabBarPageVm.$.__isVisible = false; invokeHook(curTabBarPageVm, ON_HIDE); } diff --git a/packages/uni-h5/src/framework/setup/page.ts b/packages/uni-h5/src/framework/setup/page.ts index 77e7eab9101aba7c9feb1bd6d841915d2a5fd8d9..82f9a0c5f0ab6c222857f3e764aae32bda602575 100644 --- a/packages/uni-h5/src/framework/setup/page.ts +++ b/packages/uni-h5/src/framework/setup/page.ts @@ -46,7 +46,7 @@ export function getCurrentPages() { const curPages: ComponentPublicInstance[] = [] const pages = currentPagesMap.values() for (const page of pages) { - if (page.__isTabBar) { + if (page.$.__isTabBar) { if (page.$.__isActive) { curPages.push(page) } diff --git a/packages/uni-h5/src/service/api/route/switchTab.ts b/packages/uni-h5/src/service/api/route/switchTab.ts index 95bf89f2234d6bc5527c56959f211773431dc059..cb4de0227bd78282f18cb7289733bf8f7f1e96eb 100644 --- a/packages/uni-h5/src/service/api/route/switchTab.ts +++ b/packages/uni-h5/src/service/api/route/switchTab.ts @@ -20,13 +20,13 @@ function removeNonTabBarPages() { const keys = pagesMap.keys() for (const routeKey of keys) { const page = pagesMap.get(routeKey) as ComponentPublicInstance - if (!page.__isTabBar) { + if (!page.$.__isTabBar) { removePage(routeKey) } else { page.$.__isActive = false } } - if (curTabBarPageVm.__isTabBar) { + if (curTabBarPageVm.$.__isTabBar) { curTabBarPageVm.$.__isVisible = false invokeHook(curTabBarPageVm, ON_HIDE) }