recommend-scroll-list.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="bg-white margin-top radius zaiui-recommend-box">
  3. <!--标题-->
  4. <view class="recommend-title">
  5. <view class="cu-list menu">
  6. <view class="cu-item">
  7. <view class="content">
  8. <text class="text-black text-lg">为您推荐</text>
  9. </view>
  10. <view class="action">
  11. <text class="text-gray text-sm" @tap="viewAllTap">
  12. <text>查看全部</text>
  13. <text class="cuIcon-right"/>
  14. </text>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <!--滑动列表-->
  20. <view class="recommend-scroll-box">
  21. <scroll-view class="recommend-scroll" scroll-x>
  22. <block v-for="(items,indexs) in list_data" :key="indexs">
  23. <view :id="[isSort + (indexs + 1 )]" class="text-center recommend-scroll-item">
  24. <view @tap="listTap('userTap',items,indexs)">
  25. <view class="cu-avatar xl round" :style="[{backgroundImage:'url('+ items.avatar +')'}]"/>
  26. <view class="text-black text-cut margin-tb-sm">{{items.name}}</view>
  27. </view>
  28. <button class="cu-btn sm margin-top" :class="items.follow?'bg-red':'line-red'" @tap="listTap('followTap',items,indexs)">
  29. <text class="cuIcon-add" v-if="!items.follow"></text>
  30. <text class="margin-left-xs" v-if="!items.follow">关注</text>
  31. <text v-if="items.follow">已关注</text>
  32. </button>
  33. </view>
  34. </block>
  35. </scroll-view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import _tool from '@/static/zaiui/util/tools.js';
  41. export default {
  42. name: 'recommend-scroll-list',
  43. props: {
  44. list_data: {
  45. type: Array,
  46. default: () => {
  47. return []
  48. }
  49. },
  50. isSort: {
  51. type: String,
  52. default: "recommend_scroll"
  53. }
  54. },
  55. methods: {
  56. listTap(tap,data,index) {
  57. this.$emit(tap, {
  58. data,
  59. index
  60. });
  61. },
  62. viewAllTap() {
  63. this.$emit('viewAllTap');
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .zaiui-recommend-box {
  70. border-radius: 18.18upx;
  71. .recommend-title {
  72. .cu-list.menu {
  73. border-radius: 18.18upx;
  74. }
  75. }
  76. .recommend-scroll-box {
  77. position: relative;
  78. width: 100%;
  79. .recommend-scroll {
  80. position: relative;
  81. height: 363.63upx;
  82. white-space: nowrap;
  83. width: 100%;
  84. .recommend-scroll-item {
  85. display: inline-block;
  86. padding-top: 27.27upx;
  87. width: 199.99upx;
  88. .cu-btn {
  89. &:after {
  90. border-radius: 18.18upx;
  91. }
  92. .cuIcon-add {
  93. font-size: 27.27upx;
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. </style>