fix(vue): components inside of ion-nav are now unmounted properly (#23240)

resolves #23233
This commit is contained in:
Liam DeBeasi
2021-04-26 12:58:34 -04:00
committed by GitHub
parent e436439e10
commit f2f41e2af4
3 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import { h, Teleport, VNode } from 'vue';
import { addTeleportedUserComponent, removeTeleportedUserComponent } from './components/IonApp';
export const VueDelegate = () => {
export const VueDelegate = (addFn = addTeleportedUserComponent, removeFn = removeTeleportedUserComponent) => {
let Component: VNode | undefined;
const attachViewToDom = (parentElement: HTMLElement, component: any, componentProps: any = {}, classes?: string[]) => {
/**
@ -22,13 +22,13 @@ export const VueDelegate = () => {
h(component, { ...componentProps })
);
addTeleportedUserComponent(Component);
addFn(Component);
return div;
}
const removeViewFromDom = () => {
Component && removeTeleportedUserComponent(Component);
Component && removeFn(Component);
return Promise.resolve();
}