mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
fix(vue): overlays function properly when used via controller or template (#22155)
resolves #22090
This commit is contained in:
21
packages/vue/src/framework-delegate.ts
Normal file
21
packages/vue/src/framework-delegate.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { createVNode, render } from 'vue';
|
||||
|
||||
export const VueDelegate = () => {
|
||||
const attachViewToDom = (parentElement: HTMLElement, component: any, _: any, classes?: string[]) => {
|
||||
const vueInstance = createVNode(component);
|
||||
|
||||
const div = document.createElement('div');
|
||||
classes && div.classList.add(...classes);
|
||||
|
||||
parentElement.appendChild(div);
|
||||
|
||||
render(vueInstance, div);
|
||||
}
|
||||
|
||||
const removeViewFromDom = (_: HTMLElement, childElement: any) => {
|
||||
render(null, childElement);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return { attachViewToDom, removeViewFromDom }
|
||||
}
|
Reference in New Issue
Block a user