♻️(component): [teleportWrapper]使用 mutation observer,确保即使在渲染目标元素前挂载了 teleportWrapper, 他也能正常工作

This commit is contained in:
sight
2022-09-10 21:55:56 +08:00
parent 77ff852aaa
commit b826124c92
2 changed files with 16 additions and 9 deletions

View File

@@ -1,12 +1,12 @@
import { App, Plugin } from "vue";
import { App, Component, Plugin } from "vue";
export type WithInstallType<T> = T & Plugin;
export const withInstall = <T>(comp: T): T & Plugin => {
const component = comp as any;
const component = comp as T & Component & Plugin;
component.install = (app: App) => {
app.component(component.name, comp);
app.component(component.name!, comp as T & Component & Plugin);
};
return component as T & Plugin;