attachment-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="attachment-box">
  3. <view class="attachment-title sys-color-black">附近精选</view>
  4. <view class="attachment-text sys-color-gray-9">每日推送附近优质用户来场高质量社交</view>
  5. <view class="attachment-list">
  6. <view class="attachment-item" :style="{'background-image':'url('+item.img+')'}" v-for="item in list">
  7. <view class="attachment-data">
  8. <view class="data-name sys-color-white sys-weight-600 sys-webkit-box sys-height-44">{{item.name}}</view>
  9. <view class="data-text sys-height-44">
  10. <text class="sys-height-44 sys-color-white text-item">{{item.age}}</text>
  11. <text class="sys-height-44 sys-color-white text-item">/</text>
  12. <text class="sys-height-44 sys-color-white text-item">{{item.sex}}</text>
  13. <text class="sys-height-44 sys-color-white text-item">/</text>
  14. <text class="sys-height-44 sys-color-white text-item">{{item.constellation}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: "attachment-list",
  24. components: {},
  25. props: {},
  26. data() {
  27. return {
  28. list:[]
  29. }
  30. },
  31. watch: {},
  32. mounted() {
  33. this.getAttachmentList()
  34. },
  35. methods: {
  36. getAttachmentList(){
  37. let list=[
  38. {'name':'仰看辉煌仰看辉煌仰看辉煌仰看辉煌','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/1.png'},
  39. {'name':'Maple','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/2.png'},
  40. {'name':'仰看辉煌','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/3.png'},
  41. {'name':'Maple','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/1.png'},
  42. {'name':'仰看辉煌','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/2.png'},
  43. {'name':'Maple','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/3.png'},
  44. ];
  45. this.list.push(...list)
  46. }
  47. }
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .attachment-box{
  52. .attachment-title{
  53. margin-top: 40rpx;
  54. text-align: center;
  55. font-size: 44rpx;
  56. height: 44rpx;
  57. line-height: 44rpx;
  58. -webkit-background-clip: text;
  59. }
  60. .attachment-text{
  61. text-align: center;
  62. margin-top: 16rpx;
  63. font-size: 32rpx;
  64. height: 44rpx;
  65. line-height: 44rpx;
  66. }
  67. .attachment-list{
  68. padding: 32rpx;
  69. display: flex;
  70. flex-wrap: wrap;
  71. }
  72. .attachment-item{
  73. display: inline-block;
  74. margin-right:18rpx;
  75. width: calc((100vw - 82rpx)/2);
  76. height: 504rpx;
  77. background-repeat: no-repeat;//不平铺
  78. background-position: center center;//居中
  79. background-size: cover;//随容器大小
  80. position: relative;
  81. .attachment-data{
  82. position: absolute;
  83. left: 24rpx;
  84. bottom: 24rpx;
  85. width: calc((100vw - 82rpx)/2 - 48rpx);
  86. .data-name{
  87. font-size: 36rpx;
  88. }
  89. .data-text{
  90. .text-item{
  91. margin-right: 6rpx;
  92. font-size: 24rpx;
  93. }
  94. }
  95. }
  96. }
  97. .attachment-item:nth-of-type(2n+0){
  98. margin-right:0;
  99. }
  100. .attachment-item:nth-of-type(n+3){
  101. margin-top:18rpx;
  102. }
  103. }
  104. </style>