template.uvue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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, t } from "@/.cool";
  29. import { useUi } from "@/uni_modules/cool-ui";
  30. import { computed } from "vue";
  31. const ui = useUi();
  32. type Item = {
  33. label: string;
  34. path?: string;
  35. children?: Item[];
  36. };
  37. const list = computed<Item[]>(() => [
  38. {
  39. label: t("社交"),
  40. children: [
  41. {
  42. label: t("帖子详情"),
  43. path: "/pages/template/post/detail"
  44. }
  45. ]
  46. },
  47. {
  48. label: t("商城"),
  49. children: [
  50. {
  51. label: t("商品分类"),
  52. path: "/pages/template/shop/goods-category"
  53. },
  54. {
  55. label: t("商品详情"),
  56. path: "/pages/template/shop/goods-detail/index"
  57. },
  58. {
  59. label: t("商品列表、筛选")
  60. },
  61. {
  62. label: t("购物车"),
  63. path: "/pages/template/shop/shopping-cart"
  64. },
  65. {
  66. label: t("订单列表、详情")
  67. },
  68. {
  69. label: t("收货地址"),
  70. path: "/pages/template/shop/address"
  71. }
  72. ]
  73. },
  74. {
  75. label: t("聊天"),
  76. children: [
  77. {
  78. label: t("对话列表、历史记录")
  79. }
  80. ]
  81. },
  82. {
  83. label: "AI",
  84. children: [
  85. {
  86. label: t("流式回复")
  87. },
  88. {
  89. label: t("语言合成")
  90. },
  91. {
  92. label: t("语音识别")
  93. }
  94. ]
  95. },
  96. {
  97. label: t("其他"),
  98. children: [
  99. {
  100. label: t("文件管理")
  101. }
  102. ]
  103. }
  104. ]);
  105. function toPath(item: Item) {
  106. if (item.path == null) {
  107. return ui.showToast({
  108. message: t("该模板正在开发中")
  109. });
  110. }
  111. router.to(item.path!);
  112. }
  113. </script>