fix(vue): ionic lifecycle hooks now run when using vue 3.2 setup syntax (#24253)

resolves #23824

Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
This commit is contained in:
Yuhongjie
2021-11-24 06:04:24 +08:00
committed by GitHub
parent 6f01c3b73d
commit fb96ab5a26
5 changed files with 122 additions and 5 deletions

View File

@ -80,6 +80,12 @@ const injectHook = (lifecycleType: LifecycleHooks, hook: Function, component: Co
// Add to public instance so it is accessible to IonRouterOutlet
const target = component as any;
const hooks = target.proxy[lifecycleType] || (target.proxy[lifecycleType] = []);
/**
* Define property on public instances using `setup` syntax in Vue 3.x
*/
if (target.exposed) {
target.exposed[lifecycleType] = hooks;
}
const wrappedHook = (...args: unknown[]) => {
if (target.isUnmounted) {
return;