HotProjects.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="hot-project">
  3. <div class="header">
  4. <text class="title">热门项目</text>
  5. <text class="more">查看更多</text>
  6. </div>
  7. <div class="content">
  8. <div class="wrap" v-for="item in data" :key="item.id" @click="handleToTravel(item)">
  9. <image :src="item.homeHotPicturesAfterConvert[0]" mode="aspectFill" />
  10. <div class="text-wrap">
  11. {{ item.projectTitle }}
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script setup>
  18. defineProps({
  19. data: {
  20. type: Array,
  21. default: () => [],
  22. },
  23. });
  24. function handleToTravel(item) {
  25. uni.navigateTo({
  26. url: `/pages/travel/detail?id=${item.id}`,
  27. });
  28. }
  29. </script>
  30. <style lang="scss" scoped>
  31. .hot-project {
  32. padding: 0 30rpx;
  33. .header {
  34. display: flex;
  35. justify-content: space-between;
  36. align-items: center;
  37. .title {
  38. font-size: 18px;
  39. font-weight: bold;
  40. }
  41. .more {
  42. font-size: 12px;
  43. color: #adb5bd;
  44. }
  45. }
  46. .content {
  47. margin-top: 15px;
  48. display: grid;
  49. grid-template-columns: 1fr 1fr;
  50. grid-template-rows: 380rpx 380rpx;
  51. row-gap: 20rpx;
  52. column-gap: 20rpx;
  53. .wrap {
  54. border-radius: 8px;
  55. overflow: hidden;
  56. position: relative;
  57. image {
  58. width: 100%;
  59. height: 100%;
  60. }
  61. .text-wrap {
  62. height: 47rpx;
  63. padding-left: 20rpx;
  64. padding-bottom: 20rpx;
  65. position: absolute;
  66. bottom: 0;
  67. left: 0;
  68. right: 0;
  69. background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #020202 100%);
  70. color: #fff;
  71. font-size: 14px;
  72. font-weight: bold;
  73. white-space: nowrap;
  74. overflow: hidden;
  75. text-overflow: ellipsis;
  76. }
  77. }
  78. }
  79. }
  80. </style>