dt_category_series.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view>
  3. <view class="series_list" v-if="dataList.length>0">
  4. <view class="series_item" v-for="(item,index) in dataList" :key="index" @tap="jumpGoodsList(item,index)">
  5. <!-- <image mode="aspectFill" class="series_pic" src="https://api.dreamstech.cn/img/ysyl//20191012/1c15b1d8-da65-4219-a8ae-a8e671e297891570847701931.png"></image> -->
  6. <view class="series_name">
  7. <image :src="item.icon?item.icon:'http://139.9.103.171:1888/img/image/goods_def.png'" style="width: 100%;height: 100upx;display: block;" mode="aspectFit"/>
  8. <view>{{item.name}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="no_data_wrap" v-else>
  13. <DtNoData msg="暂无数据" image="http://139.9.103.171:1888/img/image/noData.png" />
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import DtNoData from './dt_no_data'
  19. export default {
  20. components: {
  21. DtNoData,
  22. },
  23. props: {
  24. dataList: {
  25. type: Array,
  26. default: []
  27. },
  28. wrapHeight: {
  29. type: String,
  30. default: ''
  31. }
  32. },
  33. data() {
  34. return {
  35. curActive:-1,
  36. };
  37. },
  38. watch:{
  39. dataList:{
  40. deep:true,
  41. handler:function(n,o){
  42. this.curActive = 0
  43. }
  44. }
  45. },
  46. methods: {
  47. jumpGoodsList(item,index) {
  48. this.curActive = index
  49. this.$emit('tapitem',{item,index})
  50. }
  51. },
  52. created() {
  53. }
  54. };
  55. </script>
  56. <style lang="scss">
  57. .series_list {
  58. display: flex;
  59. flex-direction: row;
  60. flex-wrap: wrap;
  61. padding: 0 25upx;
  62. // justify-content: space-around;
  63. .series_item {
  64. display: flex;
  65. flex-direction: column;
  66. align-items: center;
  67. width: 170upx;
  68. margin: 20upx 10upx 20upx 0;
  69. .series_pic {
  70. width: 148upx;
  71. height: 148upx;
  72. }
  73. .series_name {
  74. font-size: 24upx;
  75. // color: rgb(51, 51, 51);
  76. width: 100%;
  77. padding:0 20upx;
  78. box-sizing: border-box;
  79. // white-space: nowrap;
  80. // overflow: hidden;
  81. // text-overflow: ellipsis;
  82. text-align: center;
  83. // margin-top: 20upx;
  84. // border:1upx solid #e5e5e5;
  85. color:#333;
  86. border-radius: 6rpx;
  87. height: 150rpx;
  88. display: flex;
  89. flex-direction: column;
  90. align-item: center;
  91. justify-content: space-between;
  92. }
  93. .series-hover{
  94. background-color:$dt-color-primary;
  95. color:#fff;
  96. }
  97. }
  98. }
  99. .no_data_wrap {
  100. display: flex;
  101. flex-direction: column;
  102. align-items: center;
  103. justify-content: center;
  104. height: 500upx;
  105. }
  106. </style>