金诚优选前端代码
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.

110 lines
2.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view class="content">
  3. <view class="title" v-if="showTitle" @click="$url('/pages/index/category/category')">{{ title }}</view>
  4. <view class="flex-box">
  5. <view class="item" v-for="(item, index) in list" :key="index"
  6. @click="$url('/pages/shop/shopdetail?id='+ item.associate.id)">
  7. <image class="bg-img" :src="item.associate.images[0] && item.associate.images[0].path"></image>
  8. <view class="shop">
  9. <image :src="item.image || item.associate.logo"></image>
  10. <view class="lf-line-1">{{ item.associate.name }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: {
  19. list: {
  20. type: Array,
  21. default: []
  22. },
  23. showTitle: {
  24. type: [Number, Boolean],
  25. default: 1
  26. },
  27. title: {
  28. type: String,
  29. default: '大牌不停推'
  30. }
  31. },
  32. data(){
  33. return {
  34. }
  35. },
  36. created(){
  37. },
  38. methods: {
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped="scoped">
  43. .content{
  44. width: 750rpx;
  45. height: max-content;
  46. box-sizing: border-box;
  47. padding: 60rpx 32rpx 0;
  48. .title{
  49. font-size: 36rpx;
  50. font-weight: bold;
  51. text-align: center;
  52. color: #222222;
  53. margin-bottom: 30rpx;
  54. }
  55. .flex-box{
  56. display: flex;
  57. flex-wrap: wrap;
  58. .item{
  59. width: 165rpx;
  60. height: 165rpx;
  61. margin-right: 9rpx;
  62. position: relative;
  63. overflow: hidden;
  64. border-radius: 5rpx;
  65. &:nth-child(4n){
  66. margin-right: 0rpx;
  67. }
  68. &:nth-child(n+5){
  69. margin-top: 8rpx;
  70. }
  71. .bg-img{
  72. position: absolute;
  73. top: 0;
  74. left: 0;
  75. width: 100%;
  76. height: 100%;
  77. }
  78. .shop{
  79. width: 100%;
  80. height: 100%;
  81. background-color: rgba(0,0,0,0.5);
  82. display: flex;
  83. flex-direction: column;
  84. justify-content: center;
  85. align-items: center;
  86. position: relative;
  87. z-index: 2;
  88. &>image{
  89. width: 70rpx;
  90. height: 70rpx;
  91. border-radius: 50%;
  92. background-color: #FFFFFF;
  93. }
  94. &>view{
  95. font-size: 24rpx;
  96. color: #FFFFFF;
  97. margin-top: 4rpx;
  98. width: 100%;
  99. text-align: center;
  100. }
  101. }
  102. }
  103. }
  104. }
  105. </style>