|
@@ -7,24 +7,24 @@ import Confirm from "./Confirm.vue";
|
|
|
import DialogContent from "./Dialog-content.vue";
|
|
|
import { createVNode, render } from 'vue'
|
|
|
|
|
|
-
|
|
|
function mount(component, { props, children, element, app } = {}) {
|
|
|
- let el = element;
|
|
|
- let vNode = createVNode(component, props, children);
|
|
|
+ let el = element
|
|
|
+ let vNode = createVNode(component, props, children)
|
|
|
|
|
|
- if (app && app._context) vNode.appContext = app._context;
|
|
|
- if (el) render(vNode, el);
|
|
|
- else if (typeof document !== "undefined") {
|
|
|
- render(vNode, (el = document.createElement("div")));
|
|
|
+ if (app && app._context) vNode.appContext = app._context
|
|
|
+ if (el) render(vNode, el)
|
|
|
+ else if (typeof document !== 'undefined') {
|
|
|
+ render(vNode, (el = document.createElement('div')))
|
|
|
}
|
|
|
|
|
|
const destroy = () => {
|
|
|
- if (el) render(null, el);
|
|
|
- el = null;
|
|
|
- vNode = null;
|
|
|
- };
|
|
|
+ if (el) render(null, el)
|
|
|
+ el = null
|
|
|
+ vNode = null
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- return { vNode, destroy, el };
|
|
|
+ return { vNode, destroy, el }
|
|
|
}
|
|
|
// const Dialog =window
|
|
|
|
|
@@ -39,10 +39,7 @@ Dialog.use = function use(app) {
|
|
|
|
|
|
const { destroy, vNode, el } = mount(Toast, {
|
|
|
app,
|
|
|
- props: {
|
|
|
- ...options,
|
|
|
- destroy,
|
|
|
- },
|
|
|
+ props: { ...options, destroy: () => destroy() },
|
|
|
});
|
|
|
|
|
|
if (!Dialog.toast._destroys) {
|