SDrawer.js 2.5 KB

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