mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(vue): improve handling of parameterized urls (#22360)
resolves #22359
This commit is contained in:
@ -46,7 +46,19 @@ export const IonRouterOutlet = defineComponent({
|
||||
// The base url for this router outlet
|
||||
let parentOutletPath: string;
|
||||
|
||||
watch(matchedRouteRef, () => setupViewItem(matchedRouteRef));
|
||||
watch(matchedRouteRef, (currentValue, previousValue) => {
|
||||
/**
|
||||
* We need to make sure that we are not re-rendering
|
||||
* the same view if navigation changes in a sub-outlet.
|
||||
* This is mainly for tabs when outlet 1 renders ion-tabs
|
||||
* and outlet 2 renders the individual tab view. We don't
|
||||
* want outlet 1 creating a new ion-tabs instance every time
|
||||
* we switch tabs.
|
||||
*/
|
||||
if (currentValue !== previousValue) {
|
||||
setupViewItem(matchedRouteRef);
|
||||
}
|
||||
});
|
||||
|
||||
const canStart = () => {
|
||||
const stack = viewStacks.getViewStack(id);
|
||||
@ -273,19 +285,6 @@ export const IonRouterOutlet = defineComponent({
|
||||
let enteringViewItem = viewStacks.findViewItemByRouteInfo(currentRoute, id);
|
||||
|
||||
if (!enteringViewItem) {
|
||||
/**
|
||||
* If we have no existing entering item, we need
|
||||
* make sure that there is no existing view according to the
|
||||
* matched route rather than what is in the url bar.
|
||||
* This is mainly for tabs when outlet 1 renders ion-tabs
|
||||
* and outlet 2 renders the individual tab view. We don't
|
||||
* want outlet 1 creating a new ion-tabs instance every time
|
||||
* we switch tabs.
|
||||
*/
|
||||
if (viewStacks.findViewItemByMatchedRoute(matchedRouteRef.value, id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
enteringViewItem = viewStacks.createViewItem(id, matchedRouteRef.value.components.default, matchedRouteRef.value, currentRoute);
|
||||
viewStacks.add(enteringViewItem);
|
||||
}
|
||||
|
Reference in New Issue
Block a user