template.uvue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <cl-page>
  3. <view class="p-3">
  4. <cl-list
  5. v-for="(item, index) in list"
  6. :key="index"
  7. :title="item.label"
  8. :pt="{
  9. className: 'mb-5'
  10. }"
  11. >
  12. <cl-list-item
  13. v-for="child in item.children"
  14. :key="child.label"
  15. :label="child.label"
  16. :arrow="child.path != null"
  17. @tap="toPath(child)"
  18. >
  19. </cl-list-item>
  20. </cl-list>
  21. </view>
  22. <!-- 自定义底部导航栏 -->
  23. <tabbar></tabbar>
  24. </cl-page>
  25. </template>
  26. <script setup lang="ts">
  27. import Tabbar from "@/components/tabbar.uvue";
  28. import { router } from "@/cool";
  29. import { t } from "@/locale";
  30. import { useUi } from "@/uni_modules/cool-ui";
  31. import { computed } from "vue";
  32. const ui = useUi();
  33. type Item = {
  34. label: string;
  35. path?: string;
  36. children?: Item[];
  37. };
  38. const list = computed<Item[]>(() => [
  39. {
  40. label: t("商城"),
  41. children: [
  42. {
  43. label: t("商品分类"),
  44. path: "/pages/template/shop/goods-category"
  45. },
  46. {
  47. label: t("商品详情")
  48. },
  49. {
  50. label: t("商品列表、筛选")
  51. },
  52. {
  53. label: t("购物车")
  54. },
  55. {
  56. label: t("订单列表、详情")
  57. }
  58. ]
  59. },
  60. {
  61. label: t("聊天"),
  62. children: [
  63. {
  64. label: t("对话列表、历史记录")
  65. }
  66. ]
  67. },
  68. {
  69. label: "AI",
  70. children: [
  71. {
  72. label: t("流式回复")
  73. },
  74. {
  75. label: t("语言合成")
  76. },
  77. {
  78. label: t("语音识别")
  79. }
  80. ]
  81. },
  82. {
  83. label: t("其他"),
  84. children: [
  85. {
  86. label: t("文件管理")
  87. }
  88. ]
  89. }
  90. ]);
  91. function toPath(item: Item) {
  92. if (item.path == null) {
  93. return ui.showToast({
  94. message: t("该模板正在开发中")
  95. });
  96. }
  97. router.to(item.path!);
  98. }
  99. </script>