提交 4b2e1751 编写于 作者: fxy060608's avatar fxy060608

fix(v3): switchTab(entryPagePath)

上级 4c0e0071
...@@ -12297,10 +12297,6 @@ var serviceContext = (function () { ...@@ -12297,10 +12297,6 @@ var serviceContext = (function () {
__uniConfig.tabBar.selected = 0; __uniConfig.tabBar.selected = 0;
const selected = __uniConfig.tabBar.list.findIndex(page => page.pagePath === __uniConfig.entryPagePath); 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) => { tabBar$1.init(__uniConfig.tabBar, (item, index) => {
uni.switchTab({ uni.switchTab({
...@@ -12316,6 +12312,12 @@ var serviceContext = (function () { ...@@ -12316,6 +12312,12 @@ var serviceContext = (function () {
} }
}); });
}); });
if (selected !== -1) {
// 取当前 tab 索引值
__uniConfig.tabBar.selected = selected;
selected !== 0 && tabBar$1.switchTab(__uniConfig.entryPagePath);
}
} }
function initEntryPage () { function initEntryPage () {
......
...@@ -119,10 +119,6 @@ function initTabBar () { ...@@ -119,10 +119,6 @@ function initTabBar () {
__uniConfig.tabBar.selected = 0 __uniConfig.tabBar.selected = 0
const selected = __uniConfig.tabBar.list.findIndex(page => page.pagePath === __uniConfig.entryPagePath) 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) => { tabBar.init(__uniConfig.tabBar, (item, index) => {
uni.switchTab({ uni.switchTab({
...@@ -138,6 +134,12 @@ function initTabBar () { ...@@ -138,6 +134,12 @@ function initTabBar () {
} }
}) })
}) })
if (selected !== -1) {
// 取当前 tab 索引值
__uniConfig.tabBar.selected = selected
selected !== 0 && tabBar.switchTab(__uniConfig.entryPagePath)
}
} }
function initEntryPage () { function initEntryPage () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册