xqq_ele
Version:
框架
33 lines (32 loc) • 744 B
JavaScript
import { defineComponent as a, ref as i, getCurrentInstance as m, onMounted as c } from "vue";
import u from "./config.js";
import f from "../icon/icon.vue.js";
const v = a({
name: "Message",
components: { XIcon: f },
props: u,
emits: ["onClose"],
setup(e) {
const o = i(!1), n = m(), t = (r) => {
o.value = !0, r.duration !== 0 && setTimeout(() => {
s();
}, r.duration);
};
c(() => {
t(e.config);
});
const s = () => {
o.value = !1, setTimeout(() => {
e.remove && n ? e.remove(n.appContext.app) : console.error("instance 实例获取失败");
}, 200);
};
return {
visibled: o,
onOpen: t,
onClose: s
};
}
});
export {
v as default
};