mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
feat(vue): add ionic vue beta (#22062)
This commit is contained in:
19
packages/vue/src/utils.ts
Normal file
19
packages/vue/src/utils.ts
Normal file
@ -0,0 +1,19 @@
|
||||
export const LIFECYCLE_WILL_ENTER = 'ionViewWillEnter';
|
||||
export const LIFECYCLE_DID_ENTER = 'ionViewDidEnter';
|
||||
export const LIFECYCLE_WILL_LEAVE = 'ionViewWillLeave';
|
||||
export const LIFECYCLE_DID_LEAVE = 'ionViewDidLeave';
|
||||
|
||||
const ids: { [k: string]: number } = { main: 0 };
|
||||
|
||||
export const generateId = (type = 'main') => {
|
||||
const id = (ids[type] ?? 0) + 1;
|
||||
ids[type] = id;
|
||||
return (id).toString();
|
||||
};
|
||||
|
||||
// TODO types
|
||||
export const fireLifecycle = (vueComponent: any, lifecycle: string) => {
|
||||
if (vueComponent && vueComponent.methods && vueComponent.methods[lifecycle]) {
|
||||
vueComponent.methods[lifecycle]();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user