mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
fix(vue): lifecycle events are correctly fired in component context (#22348)
resolves #22338
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import { Ref } from 'vue';
|
||||
|
||||
export const LIFECYCLE_WILL_ENTER = 'ionViewWillEnter';
|
||||
export const LIFECYCLE_DID_ENTER = 'ionViewDidEnter';
|
||||
export const LIFECYCLE_WILL_LEAVE = 'ionViewWillLeave';
|
||||
@ -12,8 +14,8 @@ export const generateId = (type = 'main') => {
|
||||
};
|
||||
|
||||
// TODO types
|
||||
export const fireLifecycle = (vueComponent: any, lifecycle: string) => {
|
||||
if (vueComponent && vueComponent.methods && vueComponent.methods[lifecycle]) {
|
||||
vueComponent.methods[lifecycle]();
|
||||
export const fireLifecycle = (vueComponentRef: Ref<any>, lifecycle: string) => {
|
||||
if (vueComponentRef && vueComponentRef.value && vueComponentRef.value[lifecycle]) {
|
||||
vueComponentRef.value[lifecycle]();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user