mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
fix(vue): correctly switch tabs after going back (#22309)
resolves #22307
This commit is contained in:
@ -234,15 +234,33 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
||||
const [pathname] = path.split('?');
|
||||
|
||||
if (routeInfo) {
|
||||
incomingRouteParams = Object.assign(Object.assign({}, routeInfo), { routerAction: 'push', routerDirection: 'none' });
|
||||
|
||||
const search = (routeInfo.search) ? `?${routeInfo.search}` : '';
|
||||
router.push(routeInfo.pathname + search);
|
||||
|
||||
incomingRouteParams = {
|
||||
...incomingRouteParams,
|
||||
routerAction: 'push',
|
||||
routerDirection: 'none',
|
||||
tab
|
||||
}
|
||||
|
||||
/**
|
||||
* When going back to a tab
|
||||
* you just left, it's possible
|
||||
* for the route info to be incorrect
|
||||
* as the tab you want is not the
|
||||
* tab you are on.
|
||||
*/
|
||||
if (routeInfo.pathname === pathname) {
|
||||
router.push(routeInfo.pathname + search);
|
||||
} else {
|
||||
router.push(pathname + search);
|
||||
}
|
||||
}
|
||||
else {
|
||||
handleNavigate(pathname, 'push', 'none', undefined, tab);
|
||||
}
|
||||
}
|
||||
|
||||
const handleSetCurrentTab = (tab: string) => {
|
||||
currentTab = tab;
|
||||
|
||||
|
Reference in New Issue
Block a user