mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(vue): correctly remove active state from tab button when navigating away from tab (#23000)
resolves #22597
This commit is contained in:
@ -110,13 +110,23 @@ export const IonTabBar = defineComponent({
|
||||
const activeChild = childNodes.find((child: VNode) => isTabButton(child) && child.props?.tab === activeTab);
|
||||
const tabBar = this.$refs.ionTabBar;
|
||||
const tabDidChange = activeTab !== prevActiveTab;
|
||||
if (activeChild && tabBar) {
|
||||
tabDidChange && this.$props._tabsWillChange(activeTab);
|
||||
if (tabBar) {
|
||||
if (activeChild) {
|
||||
tabDidChange && this.$props._tabsWillChange(activeTab);
|
||||
|
||||
ionRouter.handleSetCurrentTab(activeTab);
|
||||
tabBar.selectedTab = tabState.activeTab = activeTab;
|
||||
ionRouter.handleSetCurrentTab(activeTab);
|
||||
tabBar.selectedTab = tabState.activeTab = activeTab;
|
||||
|
||||
tabDidChange && this.$props._tabsDidChange(activeTab);
|
||||
tabDidChange && this.$props._tabsDidChange(activeTab);
|
||||
/**
|
||||
* When going to a tab that does
|
||||
* not have an associated ion-tab-button
|
||||
* we need to remove the selected state from
|
||||
* the old tab.
|
||||
*/
|
||||
} else {
|
||||
tabBar.selectedTab = tabState.activeTab = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user