index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <script setup lang="ts">
  2. import plateMenu from '../../components/plate/plateMenu.vue'
  3. import newPostVue from '../../components/home/newPost.vue'
  4. import redplate from '../../components/home/redplate.vue'
  5. </script>
  6. <template>
  7. <div id="home">
  8. <el-affix :offset="120"
  9. target="#home"
  10. id="plate">
  11. <Suspense>
  12. <template #default>
  13. <plateMenu />
  14. </template>
  15. <template #fallback>
  16. <el-skeleton />
  17. </template>
  18. </Suspense>
  19. </el-affix>
  20. </div>
  21. <!-- row 手机占24 电脑占12 -->
  22. <!-- 幻灯片 -->
  23. <el-row :gutter="20">
  24. <el-col :xs="24"
  25. :sm="24"
  26. :md="24"
  27. :lg="24"
  28. :xl="24">
  29. <div style="margin: 12px 0px;">
  30. <el-card>
  31. <el-carousel height="200px">
  32. <el-carousel-item v-for="item in 4"
  33. :key="item">
  34. <h3>{{ item }}</h3>
  35. </el-carousel-item>
  36. </el-carousel>
  37. </el-card>
  38. </div>
  39. </el-col>
  40. </el-row>
  41. <el-row :gutter="20">
  42. <el-col :xs="24"
  43. :sm="24"
  44. :md="24"
  45. :lg="12"
  46. :xl="12">
  47. <div style="margin: 12px 0px;">
  48. <el-card>
  49. <template #header>
  50. <span>最新帖子</span>
  51. </template>
  52. <!-- 异步最新帖子 -->
  53. <Suspense>
  54. <template #default>
  55. <newPostVue />
  56. </template>
  57. <template #fallback>
  58. <el-skeleton />
  59. </template>
  60. </Suspense>
  61. </el-card>
  62. </div>
  63. </el-col>
  64. <el-col :xs="24"
  65. :sm="24"
  66. :md="24"
  67. :lg="12"
  68. :xl="12">
  69. <div style="margin: 12px 0px;">
  70. <el-card>
  71. <template #header>
  72. <span>热门板块</span>
  73. </template>
  74. <Suspense>
  75. <template #default>
  76. <redplate />
  77. </template>
  78. <template #fallback>
  79. <el-skeleton />
  80. </template>
  81. </Suspense>
  82. </el-card>
  83. </div>
  84. </el-col>
  85. </el-row>
  86. </template>
  87. <style scoped>
  88. #home {
  89. width: 100%;
  90. }
  91. #plate {
  92. position: fixed;
  93. top: 120px;
  94. left: 0;
  95. z-index: 1000;
  96. }
  97. </style>