SPanelLayout.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { useSlots as p, computed as n, openBlock as s, createElementBlock as l, normalizeStyle as f, normalizeClass as y, createElementVNode as d, renderSlot as a, createTextVNode as m, toDisplayString as g, createCommentVNode as r } from "vue";
  2. import { n as _ } from "./index2.js";
  3. const v = {
  4. key: 0,
  5. class: "s-panel-layout-header"
  6. }, S = { class: "s-panel-layout-title" }, $ = {
  7. key: 0,
  8. class: "s-panel-layout-extra"
  9. }, k = { class: "s-panel-layout-content" }, x = {
  10. key: 1,
  11. class: "s-panel-layout-footer"
  12. }, N = /* @__PURE__ */ Object.assign({ name: "SPanelLayout" }, {
  13. __name: "SPanelLayout",
  14. props: {
  15. // 面板标题
  16. title: {
  17. type: String,
  18. default: ""
  19. },
  20. // 是否显示标题栏(传了 #extra 插槽时也会显示)
  21. showTitle: {
  22. type: Boolean,
  23. default: !0
  24. },
  25. // 面板高度:默认占满父容器,可传 '100vh' / 'calc(100vh - 60px)' / 具体像素值
  26. height: {
  27. type: [String, Number],
  28. default: "100%"
  29. }
  30. },
  31. setup(i) {
  32. const e = i, o = p(), u = n(
  33. () => !!(e.title || o.title || o.extra || o.footer)
  34. ), c = n(
  35. () => e.showTitle && !!(e.title || o.title || o.extra)
  36. ), h = n(() => !u.value || e.height === null || e.height === void 0 || e.height === "" ? null : { height: typeof e.height == "number" ? `${e.height}px` : e.height });
  37. return (t, P) => (s(), l("div", {
  38. class: y(["s-panel-layout", { "is-panel": u.value }]),
  39. style: f(h.value)
  40. }, [
  41. c.value ? (s(), l("div", v, [
  42. d("div", S, [
  43. a(t.$slots, "title", {}, () => [
  44. m(g(i.title), 1)
  45. ], !0)
  46. ]),
  47. t.$slots.extra ? (s(), l("div", $, [
  48. a(t.$slots, "extra", {}, void 0, !0)
  49. ])) : r("", !0)
  50. ])) : r("", !0),
  51. d("div", k, [
  52. a(t.$slots, "default", {}, void 0, !0)
  53. ]),
  54. t.$slots.footer ? (s(), l("div", x, [
  55. a(t.$slots, "footer", {}, void 0, !0)
  56. ])) : r("", !0)
  57. ], 6));
  58. }
  59. }), B = /* @__PURE__ */ _(N, [["__scopeId", "data-v-6ae4f1ec"]]);
  60. export {
  61. B as default
  62. };