template.uvue 1.7 KB

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