attachment-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. }
  59. .attachment-text{
  60. text-align: center;
  61. margin-top: 16rpx;
  62. font-size: 32rpx;
  63. height: 44rpx;
  64. line-height: 44rpx;
  65. }
  66. .attachment-list{
  67. padding: 32rpx;
  68. display: flex;
  69. flex-wrap: wrap;
  70. }
  71. .attachment-item{
  72. display: inline-block;
  73. margin-right:18rpx;
  74. width: calc((100vw - 82rpx)/2);
  75. height: 504rpx;
  76. background-repeat: no-repeat;//不平铺
  77. background-position: center center;//居中
  78. background-size: cover;//随容器大小
  79. position: relative;
  80. .attachment-data{
  81. position: absolute;
  82. left: 24rpx;
  83. bottom: 24rpx;
  84. width: calc((100vw - 82rpx)/2 - 48rpx);
  85. .data-name{
  86. font-size: 36rpx;
  87. }
  88. .data-text{
  89. .text-item{
  90. margin-right: 6rpx;
  91. font-size: 24rpx;
  92. }
  93. }
  94. }
  95. }
  96. .attachment-item:nth-of-type(2n+0){
  97. margin-right:0;
  98. }
  99. .attachment-item:nth-of-type(n+3){
  100. margin-top:18rpx;
  101. }
  102. }
  103. </style>