SIconModal.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { ref as n, computed as v, watch as m, resolveComponent as B, resolveDirective as D, openBlock as o, createBlock as p, withCtx as N, createElementVNode as c, createVNode as T, createElementBlock as i, Fragment as S, renderList as V, withDirectives as E, resolveDynamicComponent as H, normalizeClass as M, toDisplayString as _, createCommentVNode as U } from "vue";
  2. import { g as x, f as z } from "./icon-groups.js";
  3. import { n as F, aC as G } from "./index2.js";
  4. const L = { class: "icon-body" }, j = { class: "icon-list" }, q = ["onClick"], A = { class: "name" }, J = {
  5. key: 0,
  6. class: "icon-empty"
  7. }, K = {
  8. __name: "SIconModal",
  9. props: {
  10. // 显隐(v-model:value)
  11. value: {
  12. type: Boolean,
  13. default: !1
  14. },
  15. // 弹窗宽度
  16. width: {
  17. type: Number,
  18. default: 1028
  19. }
  20. },
  21. emits: ["update:value"],
  22. setup(d, { emit: h }) {
  23. const f = d, b = h, a = n(!1), w = v(() => x().slice(1)), r = n("outlined"), l = n(""), u = v(() => z(r.value, l.value));
  24. m(
  25. () => f.value,
  26. (e) => {
  27. a.value = e;
  28. }
  29. );
  30. const C = () => {
  31. a.value = !1, b("update:value", !1);
  32. }, y = (e) => {
  33. r.value = e;
  34. };
  35. m(a, (e) => {
  36. e || (l.value = "");
  37. });
  38. const g = (e) => {
  39. window.$message.success(`<${e}/>`);
  40. };
  41. return (e, s) => {
  42. const k = G, $ = B("s-modal"), I = D("clipboard");
  43. return o(), p($, {
  44. value: a.value,
  45. "onUpdate:value": s[1] || (s[1] = (t) => a.value = t),
  46. keyboard: "",
  47. title: e.$l("图标选择"),
  48. width: d.width,
  49. tabs: w.value,
  50. onTabsChange: y,
  51. onHandCancel: C
  52. }, {
  53. default: N(() => [
  54. c("div", L, [
  55. T(k, {
  56. value: l.value,
  57. "onUpdate:value": s[0] || (s[0] = (t) => l.value = t),
  58. class: "icon-search",
  59. placeholder: e.$l("搜索图标"),
  60. "allow-clear": ""
  61. }, null, 8, ["value", "placeholder"]),
  62. c("div", j, [
  63. (o(!0), i(S, null, V(u.value, (t) => E((o(), i("div", {
  64. key: t,
  65. class: "item-icon",
  66. onClick: (O) => g(t)
  67. }, [
  68. (o(), p(H(t), {
  69. class: M(t)
  70. }, null, 8, ["class"])),
  71. c("div", A, _(t), 1)
  72. ], 8, q)), [
  73. [I, `<${t}/>`]
  74. ])), 128)),
  75. u.value.length ? U("", !0) : (o(), i("div", J, _(e.$l("暂无数据")), 1))
  76. ])
  77. ])
  78. ]),
  79. _: 1
  80. }, 8, ["value", "title", "width", "tabs"]);
  81. };
  82. }
  83. }, W = /* @__PURE__ */ F(K, [["__scopeId", "data-v-e7b4ce29"]]);
  84. export {
  85. W as default
  86. };