UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

98 lines (97 loc) 3.95 kB
"use strict"; const vue = require("vue"); const elementPlus = require("element-plus"); const icons = require("../../icons"); const _sfc_main = vue.defineComponent({ name: "MessageBody", components: { ElIcon: elementPlus.ElIcon, CloseOutlined: icons.CloseOutlined, InfoCircleFilled: icons.InfoCircleFilled, CheckCircleFilled: icons.CheckCircleFilled, ExclamationCircleFilled: icons.ExclamationCircleFilled, CloseCircleFilled: icons.CloseCircleFilled, LoadingOutlined: icons.LoadingOutlined }, props: { /** 内容 */ message: String, /** 类型 */ type: String, /** 图标 */ icon: [String, Object, Function], /** 是否显示关闭按钮 */ showClose: Boolean, /** 内容是否是富文本 */ dangerouslyUseHTMLString: Boolean, /** 是否是加载框 */ loading: Boolean, /** 标识id */ messageId: String }, emits: { close: () => true, messageDestroy: (_messageId) => true }, setup(props, { emit }) { vue.onBeforeUnmount(() => { emit("messageDestroy", props.messageId); }); return { handleClose: () => emit("close") }; } }); 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-icon" }; const _hoisted_2 = ["innerHTML"]; const _hoisted_3 = { key: 1, class: "ele-message-content" }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { const _component_LoadingOutlined = vue.resolveComponent("LoadingOutlined"); const _component_CheckCircleFilled = vue.resolveComponent("CheckCircleFilled"); const _component_ExclamationCircleFilled = vue.resolveComponent("ExclamationCircleFilled"); const _component_CloseCircleFilled = vue.resolveComponent("CloseCircleFilled"); const _component_InfoCircleFilled = vue.resolveComponent("InfoCircleFilled"); const _component_ElIcon = vue.resolveComponent("ElIcon"); const _component_CloseOutlined = vue.resolveComponent("CloseOutlined"); return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ vue.createElementVNode("div", _hoisted_1, [ vue.createVNode(_component_ElIcon, { class: vue.normalizeClass({ "is-loading": _ctx.loading }) }, { default: vue.withCtx(() => [ _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : _ctx.loading ? (vue.openBlock(), vue.createBlock(_component_LoadingOutlined, { key: 1 })) : _ctx.type === "success" ? (vue.openBlock(), vue.createBlock(_component_CheckCircleFilled, { key: 2 })) : _ctx.type === "warning" ? (vue.openBlock(), vue.createBlock(_component_ExclamationCircleFilled, { key: 3 })) : _ctx.type === "error" ? (vue.openBlock(), vue.createBlock(_component_CloseCircleFilled, { key: 4 })) : (vue.openBlock(), vue.createBlock(_component_InfoCircleFilled, { key: 5 })) ]), _: 1 }, 8, ["class"]) ]), vue.renderSlot(_ctx.$slots, "default", {}, () => [ _ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, innerHTML: _ctx.message, class: "ele-message-content" }, null, 8, _hoisted_2)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, vue.toDisplayString(_ctx.message), 1)) ]), _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("div", { key: 0, class: "ele-message-close", onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args)) }, [ vue.createVNode(_component_ElIcon, null, { default: vue.withCtx(() => [ vue.createVNode(_component_CloseOutlined) ]), _: 1 }) ])) : vue.createCommentVNode("", true) ], 64); } const messageBody = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); module.exports = messageBody;