Q3学习计划
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.7 KiB

  1. <template>
  2. <!-- 推荐专区 -->
  3. <view class="panel hot">
  4. <view class="item" v-for="item in list" :key="item.id">
  5. <view class="title">
  6. <text class="title-text">{{ item.title }}</text>
  7. <text class="title-desc">{{ item.alt }}</text>
  8. </view>
  9. <navigator hover-class="none" :url="`/pages/hot/hot?type=${item.type}`" class="cards">
  10. <image
  11. v-for="src in item.pictures"
  12. :key="src"
  13. class="image"
  14. mode="aspectFit"
  15. :src="src"
  16. ></image>
  17. </navigator>
  18. </view>
  19. </view>
  20. </template>
  21. <script setup lang="ts">
  22. import type { HotItem } from '@/types/home'
  23. // 定义 props 接收数据
  24. defineProps<{
  25. list: HotItem[]
  26. }>()
  27. </script>
  28. <style lang="scss">
  29. /* 热门推荐 */
  30. .hot {
  31. display: flex;
  32. flex-wrap: wrap;
  33. min-height: 508rpx;
  34. margin: 20rpx 20rpx 0;
  35. border-radius: 10rpx;
  36. background-color: #fff;
  37. .title {
  38. display: flex;
  39. align-items: center;
  40. padding: 24rpx 24rpx 0;
  41. font-size: 32rpx;
  42. color: #262626;
  43. position: relative;
  44. .title-desc {
  45. font-size: 24rpx;
  46. color: #7f7f7f;
  47. margin-left: 18rpx;
  48. }
  49. }
  50. .item {
  51. display: flex;
  52. flex-direction: column;
  53. width: 50%;
  54. height: 254rpx;
  55. border-right: 1rpx solid #eee;
  56. border-top: 1rpx solid #eee;
  57. .title {
  58. justify-content: start;
  59. }
  60. &:nth-child(2n) {
  61. border-right: 0 none;
  62. }
  63. &:nth-child(-n + 2) {
  64. border-top: 0 none;
  65. }
  66. .image {
  67. width: 150rpx;
  68. height: 150rpx;
  69. }
  70. }
  71. .cards {
  72. flex: 1;
  73. padding: 15rpx 20rpx;
  74. display: flex;
  75. justify-content: space-between;
  76. align-items: center;
  77. }
  78. }
  79. </style>