index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="bg-slate-100">
  3. <view class="bg-slate-100 w-full">
  4. <view class="font-800 mt-4">基本功能</view>
  5. <view v-for="item in baseDemos" :key="item.path" class="mt-3">
  6. <view
  7. class="flex bg-white items-center justify-between p-3 mb-2"
  8. @click="goDetailPage(item.path)"
  9. >
  10. <text class="flex-1 text-4 text-dark">{{ item.title }}</text>
  11. <text class="i-carbon-chevron-right"></text>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="bg-slate-100 w-full">
  16. <view class="font-800 mt-4">页面功能</view>
  17. <view v-for="item in pageDemos" :key="item.path" class="mt-3">
  18. <view
  19. class="flex bg-white items-center justify-between p-3 mb-2"
  20. @click="goDetailPage(item.path)"
  21. >
  22. <text class="flex-1 text-4 text-dark">{{ item.title }}</text>
  23. <text class="i-carbon-chevron-right"></text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script setup lang="ts" name="TestIndex">
  30. import pagesJson from '@/pages.json'
  31. console.log(pagesJson)
  32. /** 基本功能 */
  33. const baseDemos = pagesJson.pages
  34. .filter((e) => e.path.startsWith('pages/demo/base'))
  35. .map((e) => ({
  36. title: e.style?.navigationBarTitleText || '默认页面标题',
  37. path: e.path,
  38. }))
  39. /** 页面功能 */
  40. const pageDemos = pagesJson.pages
  41. .filter((e) => e.path.startsWith('pages/demo/page'))
  42. .map((e) => ({
  43. title: e.style?.navigationBarTitleText || '默认页面标题',
  44. path: e.path,
  45. }))
  46. const goDetailPage = (path: string) => {
  47. const url = `/${path}`
  48. uni.navigateTo({
  49. url,
  50. })
  51. }
  52. </script>
  53. <style>
  54. .content {
  55. display: flex;
  56. flex-direction: column;
  57. align-items: center;
  58. justify-content: center;
  59. }
  60. .logo {
  61. width: 200rpx;
  62. height: 200rpx;
  63. margin: 200rpx auto 50rpx;
  64. }
  65. .text-area {
  66. display: flex;
  67. justify-content: center;
  68. }
  69. .title {
  70. font-size: 36rpx;
  71. color: #8f8f94;
  72. }
  73. </style>