UNPKG

yanzhen-design-vue

Version:

27 lines (26 loc) 741 B
import { createApp } from "vue"; import { closeComponent, openComponent } from "./openComponent.mjs"; const containerGroup = /* @__PURE__ */ new WeakMap(); function render(...args) { var _a; let [app, container, _namespace] = args; if (!container) container = document.createDocumentFragment(); const oldApp = containerGroup.get(container); if (oldApp) (_a = oldApp.destroy) == null ? void 0 : _a.call(oldApp); if (!app) return; const app1 = createApp(app); const close = () => { app1.unmount(); }; app1.mount(container); const confirmAppInstance = { destroy: close }; containerGroup.set(container, confirmAppInstance); return confirmAppInstance; } export { closeComponent, openComponent, render };