result2.mjs 2.7 KB

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