template.uvue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. path: "/pages/template/shop/shopping-cart"
  55. },
  56. {
  57. label: t("订单列表、详情")
  58. }
  59. ]
  60. },
  61. {
  62. label: t("聊天"),
  63. children: [
  64. {
  65. label: t("对话列表、历史记录")
  66. }
  67. ]
  68. },
  69. {
  70. label: "AI",
  71. children: [
  72. {
  73. label: t("流式回复")
  74. },
  75. {
  76. label: t("语言合成")
  77. },
  78. {
  79. label: t("语音识别")
  80. }
  81. ]
  82. },
  83. {
  84. label: t("其他"),
  85. children: [
  86. {
  87. label: t("文件管理")
  88. }
  89. ]
  90. }
  91. ]);
  92. function toPath(item: Item) {
  93. if (item.path == null) {
  94. return ui.showToast({
  95. message: t("该模板正在开发中")
  96. });
  97. }
  98. router.to(item.path!);
  99. }
  100. </script>