UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

64 lines (63 loc) 2.61 kB
import { defineComponent, getCurrentInstance, onBeforeUnmount, onMounted, resolveComponent, withDirectives, openBlock, createElementBlock, createBlock, resolveDynamicComponent, createCommentVNode, vShow } from "vue"; import { CloseOutlined, InfoCircleFilled, CheckCircleFilled, ExclamationCircleFilled, CloseCircleFilled } from "../../icons"; const _sfc_main = defineComponent({ name: "MessageBoxIcon", components: { CloseOutlined, InfoCircleFilled, CheckCircleFilled, ExclamationCircleFilled, CloseCircleFilled }, props: { /** 类型 */ type: String, /** 图标 */ icon: [String, Object, Function], /** 标识id */ boxId: String }, emits: { boxDestroy: (_boxId) => true, boxMounted: (_) => true }, setup(props, { emit }) { var _a; const ins = (_a = getCurrentInstance) == null ? void 0 : _a(); onBeforeUnmount(() => { emit("boxDestroy", props.boxId); }); onMounted(() => { var _a2, _b; emit("boxMounted", { boxId: props.boxId, // @ts-ignore doClose: (_b = (_a2 = ins == null ? void 0 : ins.ctx) == null ? void 0 : _a2.$root) == null ? void 0 : _b.doClose }); }); return {}; } }); const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; const _hoisted_1 = { class: "ele-message-box-icon" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_CheckCircleFilled = resolveComponent("CheckCircleFilled"); const _component_ExclamationCircleFilled = resolveComponent("ExclamationCircleFilled"); const _component_CloseCircleFilled = resolveComponent("CloseCircleFilled"); const _component_InfoCircleFilled = resolveComponent("InfoCircleFilled"); return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [ _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : _ctx.type === "success" ? (openBlock(), createBlock(_component_CheckCircleFilled, { key: 1 })) : _ctx.type === "warning" ? (openBlock(), createBlock(_component_ExclamationCircleFilled, { key: 2 })) : _ctx.type === "error" ? (openBlock(), createBlock(_component_CloseCircleFilled, { key: 3 })) : _ctx.type === "info" ? (openBlock(), createBlock(_component_InfoCircleFilled, { key: 4 })) : createCommentVNode("", true) ], 512)), [ [vShow, _ctx.type || _ctx.icon] ]); } const messageBoxIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { messageBoxIcon as default };