mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
fix(vue): query strings are now correctly handled when navigating back (#22615)
resolves #22517
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
parseQuery,
|
||||||
Router,
|
Router,
|
||||||
RouteLocationNormalized,
|
RouteLocationNormalized,
|
||||||
NavigationFailure
|
NavigationFailure
|
||||||
@ -90,7 +91,7 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
|||||||
if (routeInfo.lastPathname === routeInfo.pushedByRoute) {
|
if (routeInfo.lastPathname === routeInfo.pushedByRoute) {
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
router.replace(prevInfo.pathname + (prevInfo.search || ''));
|
router.replace({ path: prevInfo.pathname, query: parseQuery(prevInfo.search) });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handleNavigate(defaultHref, 'pop', 'back');
|
handleNavigate(defaultHref, 'pop', 'back');
|
||||||
@ -236,7 +237,7 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
|||||||
const newRouteInfo = { ...routeInfo };
|
const newRouteInfo = { ...routeInfo };
|
||||||
newRouteInfo.pathname = originalHref;
|
newRouteInfo.pathname = originalHref;
|
||||||
incomingRouteParams = { ...newRouteInfo, routerAction: 'pop', routerDirection: 'back' };
|
incomingRouteParams = { ...newRouteInfo, routerAction: 'pop', routerDirection: 'back' };
|
||||||
router.push(newRouteInfo.pathname + (newRouteInfo.search || ''));
|
router.push({ path: newRouteInfo.pathname, query: parseQuery(newRouteInfo.search) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,8 +246,6 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
|||||||
const [pathname] = path.split('?');
|
const [pathname] = path.split('?');
|
||||||
|
|
||||||
if (routeInfo) {
|
if (routeInfo) {
|
||||||
const search = (routeInfo.search) ? `?${routeInfo.search}` : '';
|
|
||||||
|
|
||||||
incomingRouteParams = {
|
incomingRouteParams = {
|
||||||
...incomingRouteParams,
|
...incomingRouteParams,
|
||||||
routerAction: 'push',
|
routerAction: 'push',
|
||||||
@ -262,9 +261,9 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
|||||||
* tab you are on.
|
* tab you are on.
|
||||||
*/
|
*/
|
||||||
if (routeInfo.pathname === pathname) {
|
if (routeInfo.pathname === pathname) {
|
||||||
router.push(routeInfo.pathname + search);
|
router.push({ path: routeInfo.pathname, query: parseQuery(routeInfo.search) });
|
||||||
} else {
|
} else {
|
||||||
router.push(pathname + search);
|
router.push({ path: pathname, query: parseQuery(routeInfo.search) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user