template.uvue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. <custom-tabbar></custom-tabbar>
  24. </cl-page>
  25. </template>
  26. <script setup lang="ts">
  27. import CustomTabbar 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/post/detail"
  45. }
  46. ]
  47. },
  48. {
  49. label: t("商城"),
  50. children: [
  51. {
  52. label: t("商品分类"),
  53. path: "/pages/template/shop/goods-category"
  54. },
  55. {
  56. label: t("商品详情"),
  57. path: "/pages/template/shop/goods-detail/index"
  58. },
  59. {
  60. label: t("商品列表、筛选")
  61. },
  62. {
  63. label: t("购物车"),
  64. path: "/pages/template/shop/shopping-cart"
  65. },
  66. {
  67. label: t("订单列表、详情")
  68. },
  69. {
  70. label: t("收货地址"),
  71. path: "/pages/template/shop/address"
  72. }
  73. ]
  74. },
  75. {
  76. label: t("聊天"),
  77. children: [
  78. {
  79. label: t("对话列表、历史记录")
  80. }
  81. ]
  82. },
  83. {
  84. label: "AI",
  85. children: [
  86. {
  87. label: t("流式回复")
  88. },
  89. {
  90. label: t("语言合成")
  91. },
  92. {
  93. label: t("语音识别")
  94. }
  95. ]
  96. },
  97. {
  98. label: t("其他"),
  99. children: [
  100. {
  101. label: t("文件管理")
  102. }
  103. ]
  104. }
  105. ]);
  106. function toPath(item: Item) {
  107. if (item.path == null) {
  108. return ui.showToast({
  109. message: t("该模板正在开发中")
  110. });
  111. }
  112. router.to(item.path!);
  113. }
  114. </script>