user-list.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="user-list">
  3. <scroll-view :scroll-x="true" class="scroll-box">
  4. <view class="user-box">
  5. <view class="user first">
  6. <image :src="avatar" class="user-head"></image> <text>拼主</text>
  7. </view>
  8. </view>
  9. <view class="user-box" v-for="i in memberNum - 1" :key="i">
  10. <view class="user">
  11. <image v-if="i < existNum - 1" :src="avatar" class="user-head"></image>
  12. </view>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. // 总人数
  21. memberNum: {
  22. type: Number,
  23. default: 0
  24. },
  25. // 已有人数
  26. existNum:{
  27. type: Number,
  28. default: 0
  29. }
  30. },
  31. computed:{
  32. avatar(){
  33. return this.$Static + 'icon-default-avatar.png'
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .flex-center-box {
  40. display: flex;
  41. justify-content: center;
  42. align-items: center;
  43. }
  44. .user-list {
  45. padding: 0 24rpx;
  46. .scroll-box {
  47. white-space: nowrap;
  48. text-align: center;
  49. }
  50. .user-box {
  51. display: inline-block;
  52. margin: 12rpx 12rpx;
  53. }
  54. // @extend .flex-center-box;
  55. .user {
  56. @extend .flex-center-box;
  57. position: relative;
  58. width: 100rpx;
  59. height: 100rpx;
  60. border-radius: 50%;
  61. border: 2rpx dashed #cccccc;
  62. border-radius: 50%;
  63. box-sizing: border-box;
  64. &::before {
  65. content: '?';
  66. font-size: 36rpx;
  67. color: #999999;
  68. }
  69. .user-head {
  70. position: absolute;
  71. left: -2rpx;
  72. top: -2rpx;
  73. z-index: 1;
  74. display: block;
  75. width: 100rpx;
  76. height: 100rpx;
  77. border-radius: 50%;
  78. }
  79. text {
  80. @extend .flex-center-box;
  81. position: absolute;
  82. left: -12rpx;
  83. top: 0;
  84. z-index: 2;
  85. width: 56rpx;
  86. height: 28rpx;
  87. background: #ff457b;
  88. border: 1rpx solid #ffffff;
  89. border-radius: 14rpx;
  90. font-size: 20rpx;
  91. color: #ffffff;
  92. }
  93. }
  94. }
  95. </style>