UNPKG

@wetspace/pro-components

Version:
57 lines (56 loc) 1.58 kB
import { shallowRef as v, h as e, defineAsyncComponent as y, watch as C, render as c } from "vue"; import { ElDialog as h, ElSpace as b, ElButton as d } from "element-plus"; const w = (s = { content: "" }) => { const l = document.querySelector("body"), o = document.createElement("div"); l == null || l.appendChild(o); const t = v(!1), { title: i, content: n, contentProps: r, modalProps: f } = s, p = typeof n == "function", m = e({ setup() { return () => e(h, { ...f, title: i, modelValue: t.value, appendToBody: !0, closeOnClickModal: !1, "onUpdate:modelValue": (a) => { t.value = a; } }, { default() { return p ? e(y(n), { ...r }) : typeof n == "object" ? e(n, { ...r }) : e("span", {}, { default: () => n }); }, footer() { return e(b, {}, { default() { return [ e(d, { onClick() { t.value = !1; } }, { default: () => "取消" }), e(d, { type: "primary", onClick() { t.value = !1; } }, { default: () => "确定" }) ]; } }); } }); } }); setTimeout(() => { t.value = !0; }), C(t, (a) => { a || setTimeout(() => { var u; c(null, o), (u = o.parentNode) == null || u.removeChild(o); }, 1e3); }), c(m, o); }; export { w as openModal };