result2.mjs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, toDisplayString } from 'vue';
  2. import '../../../hooks/index.mjs';
  3. import { resultProps, IconMap, IconComponentMap } from './result.mjs';
  4. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  5. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  6. const __default__ = defineComponent({
  7. name: "ElResult"
  8. });
  9. const _sfc_main = /* @__PURE__ */ defineComponent({
  10. ...__default__,
  11. props: resultProps,
  12. setup(__props) {
  13. const props = __props;
  14. const ns = useNamespace("result");
  15. const resultIcon = computed(() => {
  16. const icon = props.icon;
  17. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  18. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  19. return {
  20. class: iconClass,
  21. component: iconComponent
  22. };
  23. });
  24. return (_ctx, _cache) => {
  25. return openBlock(), createElementBlock("div", {
  26. class: normalizeClass(unref(ns).b())
  27. }, [
  28. createElementVNode("div", {
  29. class: normalizeClass(unref(ns).e("icon"))
  30. }, [
  31. renderSlot(_ctx.$slots, "icon", {}, () => [
  32. unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
  33. key: 0,
  34. class: normalizeClass(unref(resultIcon).class)
  35. }, null, 8, ["class"])) : createCommentVNode("v-if", true)
  36. ])
  37. ], 2),
  38. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  39. key: 0,
  40. class: normalizeClass(unref(ns).e("title"))
  41. }, [
  42. renderSlot(_ctx.$slots, "title", {}, () => [
  43. createElementVNode("p", null, toDisplayString(_ctx.title), 1)
  44. ])
  45. ], 2)) : createCommentVNode("v-if", true),
  46. _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  47. key: 1,
  48. class: normalizeClass(unref(ns).e("subtitle"))
  49. }, [
  50. renderSlot(_ctx.$slots, "sub-title", {}, () => [
  51. createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
  52. ])
  53. ], 2)) : createCommentVNode("v-if", true),
  54. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  55. key: 2,
  56. class: normalizeClass(unref(ns).e("extra"))
  57. }, [
  58. renderSlot(_ctx.$slots, "extra")
  59. ], 2)) : createCommentVNode("v-if", true)
  60. ], 2);
  61. };
  62. }
  63. });
  64. var Result = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "result.vue"]]);
  65. export { Result as default };
  66. //# sourceMappingURL=result2.mjs.map