mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(vue): lifecycle events are correctly fired in component context (#22348)
resolves #22338
This commit is contained in:
@ -182,13 +182,13 @@ export const IonRouterOutlet = defineComponent({
|
||||
|
||||
if (enteringViewItem === leavingViewItem) return;
|
||||
|
||||
fireLifecycle(enteringViewItem.vueComponent, LIFECYCLE_WILL_ENTER);
|
||||
fireLifecycle(enteringViewItem.vueComponentRef, LIFECYCLE_WILL_ENTER);
|
||||
|
||||
if (leavingViewItem) {
|
||||
let animationBuilder = routerAnimation;
|
||||
const leavingEl = leavingViewItem.ionPageElement;
|
||||
|
||||
fireLifecycle(leavingViewItem.vueComponent, LIFECYCLE_WILL_LEAVE);
|
||||
fireLifecycle(leavingViewItem.vueComponentRef, LIFECYCLE_WILL_LEAVE);
|
||||
|
||||
/**
|
||||
* If we are going back from a page that
|
||||
@ -230,7 +230,7 @@ export const IonRouterOutlet = defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
fireLifecycle(leavingViewItem.vueComponent, LIFECYCLE_DID_LEAVE);
|
||||
fireLifecycle(leavingViewItem.vueComponentRef, LIFECYCLE_DID_LEAVE);
|
||||
} else {
|
||||
/**
|
||||
* If there is no leaving element, just show
|
||||
@ -241,7 +241,7 @@ export const IonRouterOutlet = defineComponent({
|
||||
requestAnimationFrame(() => enteringEl.classList.remove('ion-page-invisible'));
|
||||
}
|
||||
|
||||
fireLifecycle(enteringViewItem.vueComponent, LIFECYCLE_DID_ENTER);
|
||||
fireLifecycle(enteringViewItem.vueComponentRef, LIFECYCLE_DID_ENTER);
|
||||
|
||||
components.value = viewStacks.getChildrenToRender(id);
|
||||
}
|
||||
@ -359,6 +359,7 @@ export const IonRouterOutlet = defineComponent({
|
||||
return h(
|
||||
c.vueComponent,
|
||||
{
|
||||
ref: c.vueComponentRef,
|
||||
key: c.pathname,
|
||||
isInOutlet: true,
|
||||
registerIonPage: (ionPageEl: HTMLElement) => registerIonPage(c, ionPageEl)
|
||||
|
Reference in New Issue
Block a user