diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index de772e23dc2a91edd50f61039ecb45448c63b3e0..527f20727bb976cf546d474b29f9ea70974d39ec 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -12297,10 +12297,6 @@ var serviceContext = (function () { __uniConfig.tabBar.selected = 0; const selected = __uniConfig.tabBar.list.findIndex(page => page.pagePath === __uniConfig.entryPagePath); - if (selected !== -1) { - // 取当前 tab 索引值 - __uniConfig.tabBar.selected = selected; - } tabBar$1.init(__uniConfig.tabBar, (item, index) => { uni.switchTab({ @@ -12316,6 +12312,12 @@ var serviceContext = (function () { } }); }); + + if (selected !== -1) { + // 取当前 tab 索引值 + __uniConfig.tabBar.selected = selected; + selected !== 0 && tabBar$1.switchTab(__uniConfig.entryPagePath); + } } function initEntryPage () { diff --git a/src/platforms/app-plus/service/framework/app.js b/src/platforms/app-plus/service/framework/app.js index 103be320fcd0ebcc731e1808f45e4ae76bacc9bf..2e2881d4d77b49c134a1c7555dfc9578fc3aea61 100644 --- a/src/platforms/app-plus/service/framework/app.js +++ b/src/platforms/app-plus/service/framework/app.js @@ -119,10 +119,6 @@ function initTabBar () { __uniConfig.tabBar.selected = 0 const selected = __uniConfig.tabBar.list.findIndex(page => page.pagePath === __uniConfig.entryPagePath) - if (selected !== -1) { - // 取当前 tab 索引值 - __uniConfig.tabBar.selected = selected - } tabBar.init(__uniConfig.tabBar, (item, index) => { uni.switchTab({ @@ -138,6 +134,12 @@ function initTabBar () { } }) }) + + if (selected !== -1) { + // 取当前 tab 索引值 + __uniConfig.tabBar.selected = selected + selected !== 0 && tabBar.switchTab(__uniConfig.entryPagePath) + } } function initEntryPage () {