scroll-list.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view>
  3. <scroll-view class="scroll_list" :style="{'background': background}" scroll-x="true">
  4. <view class="main-left" style="padding-left: 40rpx;">
  5. <view v-for="(item,index) in list" :key="index" @click="goPage(item.id)">
  6. <view class="box" :style="{'width':itemWidth,'height':itemHeight}" >
  7. <image class="image-bg" :src="item.cover_img" mode="aspectFill"></image>
  8. <view class="text t-omit">{{item.title?item.title:''}}</view>
  9. </view>
  10. <view class="tag_list" v-if="item.tag">
  11. <text class="tag">{{item.tag}}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. </view>
  17. </template>
  18. <script>
  19. let defaultList = [{
  20. image: 'https://t17.9026.com/web/statics/image/index/2.png',
  21. title: '定制产品',
  22. tag: '定制',
  23. link:''
  24. },
  25. {
  26. image: 'https://t17.9026.com/web/statics/image/index/2.png',
  27. title: '热销方案',
  28. tag: '热销',
  29. link:'/pages/case/hot_sale_project'
  30. },
  31. {
  32. image: 'https://t17.9026.com/web/statics/image/index/2.png',
  33. title: '主题专区',
  34. tag: '主题',
  35. link:'/pages/case/themeArea'
  36. },
  37. {
  38. image: 'https://t17.9026.com/web/statics/image/index/2.png',
  39. title: '定制产品',
  40. tag: '定制'
  41. }
  42. ];
  43. export default {
  44. name: "app-scroll-list",
  45. props: {
  46. list: {
  47. type: Array,
  48. default: () => {
  49. return defaultList
  50. }
  51. },
  52. background: {
  53. type: String,
  54. default: ''
  55. },
  56. itemWidth:{
  57. type:[String,Number],
  58. default:'207rpx'
  59. },
  60. itemHeight:{
  61. type:[String,Number],
  62. default:'250rpx'
  63. }
  64. },
  65. data() {
  66. return {
  67. }
  68. },
  69. methods: {
  70. goPage(id){
  71. uni.navigateTo({
  72. url:"/pages/program/program?id="+id
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .scroll_list {
  80. padding: 15rpx 0 28rpx;
  81. .box {
  82. border-radius: 20rpx;
  83. overflow: hidden;
  84. position: relative;
  85. z-index: 2;
  86. margin-right: 20rpx;
  87. .image-bg {
  88. position: absolute;
  89. z-index: -1;
  90. left: 0;
  91. right: 0;
  92. bottom: 0;
  93. right: 0;
  94. width: 100%;
  95. height: 100%;
  96. }
  97. .text {
  98. width: 115rpx;
  99. font-size: 28rpx;
  100. font-weight: 600;
  101. color: #FEFFFE;
  102. text-shadow: 0px 0px 8px rgba(0, 0, 0, 0.17);
  103. position: absolute;
  104. top: 30rpx;
  105. left: 50%;
  106. transform: translateX(-50%);
  107. z-index: 1;
  108. }
  109. }
  110. .tag_list {
  111. margin-top: 20rpx;
  112. .tag {
  113. background-color: rgba(238, 235, 222, 1);
  114. color: rgb(167, 133, 79);
  115. border-radius: 0 50% 50% 50%;
  116. font-size: 24rpx;
  117. padding: 10rpx 20rpx;
  118. }
  119. }
  120. }
  121. </style>