docs.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { resolveComponent as t, openBlock as c, createBlock as s, withCtx as l, createCommentVNode as p, createVNode as r, defineAsyncComponent as a } from "vue";
  2. import { n as g } from "./index2.js";
  3. const b = {
  4. name: "DocsPage",
  5. components: {
  6. GuideDoc: a(() => import("./guide-doc.js")),
  7. ComponentsDoc: a(() => import("./components-doc.js")),
  8. ToolsDoc: a(() => import("./tools-doc.js"))
  9. },
  10. data() {
  11. return {
  12. active: "guide",
  13. tabs: [
  14. {
  15. label: this.$l("首页"),
  16. value: "/"
  17. },
  18. {
  19. label: this.$l("说明文档"),
  20. value: "guide"
  21. },
  22. {
  23. label: this.$l("内置组件"),
  24. value: "components"
  25. },
  26. {
  27. label: this.$l("工具配置"),
  28. value: "tools"
  29. }
  30. ]
  31. };
  32. },
  33. computed: {
  34. view() {
  35. return this.tabs.find((n) => n.value === this.active).value;
  36. },
  37. pageTitle() {
  38. return {
  39. guide: window.$l("sapit-ui 文档"),
  40. components: window.$l("sapit-ui 基座组件"),
  41. tools: window.$l("sapit-ui 工具与配置")
  42. }[this.view];
  43. }
  44. },
  45. methods: {
  46. onChange(e) {
  47. if (e === "/") {
  48. this.$push("/");
  49. return;
  50. }
  51. this.active = e;
  52. }
  53. },
  54. watch: {
  55. // 三个视图共用一个滚动容器,切页后必须归顶,否则会停在上一个页面的位置
  56. view() {
  57. this.$nextTick(() => {
  58. const e = this.$el.querySelector(".s-panel-layout-content");
  59. e && (e.scrollTop = 0);
  60. });
  61. }
  62. }
  63. };
  64. function f(e, n, y, k, i, o) {
  65. const u = t("s-tab"), d = t("guide-doc"), m = t("components-doc"), _ = t("tools-doc"), h = t("s-back-top"), v = t("s-panel-layout");
  66. return c(), s(v, {
  67. title: o.pageTitle,
  68. width: "1200px",
  69. height: "100vh",
  70. headerSticky: !0
  71. }, {
  72. extra: l(() => [
  73. r(u, {
  74. activeKey: i.active,
  75. "onUpdate:activeKey": n[0] || (n[0] = (w) => i.active = w),
  76. tabs: i.tabs,
  77. onChange: o.onChange
  78. }, null, 8, ["activeKey", "tabs", "onChange"])
  79. ]),
  80. default: l(() => [
  81. o.view === "guide" ? (c(), s(d, { key: 0 })) : o.view === "components" ? (c(), s(m, { key: 1 })) : p("", !0),
  82. o.view === "tools" ? (c(), s(_, { key: 2 })) : p("", !0),
  83. r(h)
  84. ]),
  85. _: 1
  86. }, 8, ["title"]);
  87. }
  88. const $ = /* @__PURE__ */ g(b, [["render", f], ["__scopeId", "data-v-0ed057d6"]]);
  89. export {
  90. $ as default
  91. };