SEmpty.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { getCurrentInstance as u, ref as l, onMounted as m, openBlock as s, createElementBlock as a, createVNode as _, withCtx as y, renderSlot as f, toDisplayString as E } from "vue";
  2. import { r as g, s as o } from "./index2.js";
  3. const S = { class: "s-empty-common" }, v = {
  4. key: 0,
  5. class: "description"
  6. }, I = {
  7. key: 1,
  8. class: "description"
  9. }, h = {
  10. __name: "SEmpty",
  11. props: {
  12. /**
  13. * icon类型
  14. * @type
  15. */
  16. type: {
  17. type: [String, Number],
  18. default: 1
  19. },
  20. /**
  21. * 提示信息
  22. * @icon
  23. */
  24. icon: {
  25. type: [String, Object],
  26. default: ""
  27. },
  28. /**
  29. * 描述信息
  30. * @desc
  31. */
  32. desc: {
  33. type: [String, Boolean],
  34. default() {
  35. }
  36. },
  37. /**
  38. * 图片样式
  39. * @desc
  40. */
  41. iconStyle: {
  42. type: Object,
  43. default() {
  44. return {};
  45. }
  46. }
  47. },
  48. setup(c) {
  49. const r = u(), { $l: i } = r.appContext.config.globalProperties, e = c, t = l(""), n = l("");
  50. return m(() => {
  51. e.icon ? t.value = e.icon : parseInt(e.type) === 1 ? t.value = o.PRESENTED_IMAGE_DEFAULT : parseInt(e.type) === 2 ? t.value = o.PRESENTED_IMAGE_SIMPLE : (t.value = o.PRESENTED_IMAGE_DEFAULT, console.warn('内置type类型为:1 或者 2,如需其他类型,请使用icon属性,例如:icon="https://xxx.png')), e.desc === void 0 ? n.value = i("暂无数据", "components.empty") : typeof e.desc == "string" ? n.value = e.desc.trim() : n.value = i("暂无数据", "components.empty");
  52. }), (p, x) => {
  53. const d = o;
  54. return s(), a("div", S, [
  55. _(d, {
  56. image: t.value,
  57. imageStyle: c.iconStyle
  58. }, {
  59. description: y(() => [
  60. p.$slots.default ? (s(), a("span", v, [
  61. f(p.$slots, "default", {}, void 0, !0)
  62. ])) : (s(), a("span", I, E(n.value), 1))
  63. ]),
  64. _: 3
  65. }, 8, ["image", "imageStyle"])
  66. ]);
  67. };
  68. }
  69. }, M = /* @__PURE__ */ g(h, [["__scopeId", "data-v-a3108dac"]]);
  70. export {
  71. M as default
  72. };