SEmpty.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { getCurrentInstance as d, ref as p, onMounted as _, openBlock as s, createElementBlock as a, createVNode as m, withCtx as f, renderSlot as y, toDisplayString as E } from "vue";
  2. import { l as g, V 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 = d(), { $l: i } = r.appContext.config.globalProperties, e = c, t = p(""), n = p("");
  50. return _(() => {
  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(
  52. '内置type类型为:1 或者 2,如需其他类型,请使用icon属性,例如:icon="https://xxx.png'
  53. )), e.desc === void 0 ? n.value = i("暂无数据") : typeof e.desc == "string" ? n.value = e.desc.trim() : n.value = i("暂无数据");
  54. }), (l, x) => {
  55. const u = o;
  56. return s(), a("div", S, [
  57. m(u, {
  58. image: t.value,
  59. imageStyle: c.iconStyle
  60. }, {
  61. description: f(() => [
  62. l.$slots.default ? (s(), a("span", v, [
  63. y(l.$slots, "default", {}, void 0, !0)
  64. ])) : (s(), a("span", I, E(n.value), 1))
  65. ]),
  66. _: 3
  67. }, 8, ["image", "imageStyle"])
  68. ]);
  69. };
  70. }
  71. }, A = /* @__PURE__ */ g(h, [["__scopeId", "data-v-50c931b5"]]);
  72. export {
  73. A as default
  74. };