@nextcloud/vue
Version:
Nextcloud vue components
28 lines (27 loc) • 855 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Vue = require("vue");
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
const Vue__default = /* @__PURE__ */ _interopDefault(Vue);
function spawnDialog(dialog, props, onClose = () => {
}) {
const el = document.createElement("div");
const container = typeof props?.container === "string" ? document.querySelector(props.container) || document.body : document.body;
container.appendChild(el);
const vm = new Vue__default.default({
el,
name: "VueDialogHelper",
render: (h) => h(dialog, {
props,
on: {
close: (...rest) => {
onClose(...rest.map((v) => Vue.toRaw(v)));
vm.$destroy();
el.remove();
}
}
})
});
return vm;
}
exports.spawnDialog = spawnDialog;