participant.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="participant">
  3. <view class="title">已有{{userOrder.length}}人参与</view>
  4. <view class="content dir-left-wrap">
  5. <image class="avatar" :src="item.user.userInfo.avatar" v-for="(item, index) in newUserOrder" :key="index" :class="{'margin-right': filter(index)}"></image>
  6. </view>
  7. <view class="no-more" v-if="userOrder.length> 30">仅显示最近参与30人</view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: 'participant',
  13. props: [`userOrder`],
  14. methods: {
  15. filter(data) {
  16. return /[9]/.test(data);
  17. }
  18. },
  19. computed: {
  20. newUserOrder() {
  21. if (this.userOrder.length > 30) {
  22. return this.userOrder.slice(0, 30);
  23. } else {
  24. return this.userOrder;
  25. }
  26. }
  27. }
  28. }
  29. </script>
  30. <style lang="scss" scoped>
  31. .participant {
  32. width: #{638upx};
  33. border-top:#{1upx} solid #e2e2e2;
  34. .title {
  35. font-size: #{28upx};
  36. line-height: 1;
  37. text-align: center;
  38. color: #353535;
  39. margin: #{40upx 0 32upx 0};
  40. }
  41. .avatar {
  42. width: #{56upx};
  43. height: #{56upx};
  44. margin-bottom: #{20upx};
  45. margin-right: #{8upx};
  46. }
  47. .margin-right {
  48. margin-right: #{6upx};
  49. }
  50. .no-more {
  51. margin-top: #{12upx};
  52. font-size: #{24upx};
  53. color: #999999;
  54. text-align: center;
  55. }
  56. }
  57. </style>