SDrawer.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { ref as n, watch as b, watchEffect as g, openBlock as S, createBlock as C, withCtx as a, createElementVNode as c, renderSlot as m, createVNode as s, createTextVNode as u, toDisplayString as f } from "vue";
  2. import { n as N, B as $ } from "./index2.js";
  3. import { _ as k } from "./index8.js";
  4. import { S as B } from "./index9.js";
  5. const D = { class: "s-drawer-body" }, x = { class: "s-drawer-footer" }, z = {
  6. __name: "SDrawer",
  7. props: {
  8. value: {
  9. type: Boolean,
  10. default: !1
  11. },
  12. title: {
  13. type: String,
  14. default: ""
  15. },
  16. mode: {
  17. type: String,
  18. default: "right"
  19. },
  20. width: {
  21. type: Number,
  22. default: 500
  23. },
  24. height: {
  25. type: Number,
  26. default: 378
  27. }
  28. },
  29. emits: ["update:value", "confirm"],
  30. setup(o, { emit: p }) {
  31. const l = p, t = o, i = n(t.value);
  32. b(
  33. () => t.value,
  34. (e) => {
  35. i.value = e;
  36. },
  37. { immediate: !0 }
  38. );
  39. const _ = n(t.mode), h = n(8);
  40. g(() => {
  41. const e = {
  42. left: "",
  43. right: "",
  44. top: "",
  45. bottom: ""
  46. };
  47. Object.keys(e).includes(t.mode) || (console.warn(`当前设置mode【${t.mode}】不在【${e}】中,已默认为【right】`), _.value = "right");
  48. });
  49. const r = () => {
  50. l("update:value", !1);
  51. }, v = () => {
  52. l("update:value", !1), l("confirm");
  53. };
  54. return (e, V) => {
  55. const d = $, w = B, y = k;
  56. return S(), C(y, {
  57. rootClassName: "s-drawer-wrap",
  58. title: o.title,
  59. placement: o.mode,
  60. width: o.width,
  61. visible: i.value,
  62. onClose: r,
  63. bodyStyle: {
  64. padding: 0,
  65. display: "flex",
  66. flexDirection: "column"
  67. }
  68. }, {
  69. default: a(() => [
  70. c("div", D, [
  71. m(e.$slots, "default", {}, void 0, !0)
  72. ]),
  73. c("div", x, [
  74. s(w, { size: h.value }, {
  75. default: a(() => [
  76. m(e.$slots, "footer", {}, () => [
  77. s(d, { onClick: r }, {
  78. default: a(() => [
  79. u(f(e.$l("取消")), 1)
  80. ]),
  81. _: 1
  82. }),
  83. s(d, {
  84. type: "primary",
  85. onClick: v
  86. }, {
  87. default: a(() => [
  88. u(f(e.$l("确定")), 1)
  89. ]),
  90. _: 1
  91. })
  92. ], !0)
  93. ]),
  94. _: 3
  95. }, 8, ["size"])
  96. ])
  97. ]),
  98. _: 3
  99. }, 8, ["title", "placement", "width", "visible"]);
  100. };
  101. }
  102. }, T = /* @__PURE__ */ N(z, [["__scopeId", "data-v-dddcb41d"]]);
  103. export {
  104. T as default
  105. };