t-fighting-design
Version:
Fighting design can quickly build interactive interfaces in vue3 applications, which looks good.
55 lines (54 loc) • 1.29 kB
JavaScript
import l from "../../message/src/index2.js";
import f from "../../notification/src/index2.js";
import { createVNode as g, render as i } from "vue";
import { useMassageManage as u } from "../use-message-mange/index.js";
import "../../loading-bar/src/index2.js";
const E = u(), h = ["default", "primary", "success", "danger", "warning"], x = (o) => {
let c = 1;
const d = {
message: { placement: "top" },
notification: { placement: "top-right" }
}, p = {
message: l,
notification: f
}, t = (e) => {
const n = document.createElement("div"), a = `message-${c}`;
typeof e == "string" && (e = {
message: e
});
const s = {
id: a,
...d[o],
...e
};
s.onDestroy = () => {
s.closeEnd && s.closeEnd(), i(null, n);
};
const m = g(p[o], s);
i(m, n), document.body.appendChild(n.firstElementChild);
const r = m.component;
return c++, E.createInstance(
{
id: a,
vm: r,
close: () => {
r.exposed.close();
},
bottom: 0,
visible: 0
},
s.placement
);
};
return h.forEach((e) => {
t[e] = (n) => {
t({ message: n, type: e });
};
}), {
instance: t
};
};
export {
E as massageManage,
x as useMessage
};