style-four.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="style-four dir-left-nowrap">
  3. <app-category-list
  4. @click="active"
  5. :list="list"
  6. :noSetHeight="setHeight+'rpx'"
  7. v-if="list.length !== 0"
  8. ></app-category-list>
  9. <scroll-view scroll-y class="right" :style="{height: `${setHeight}rpx`}" v-if="list.length !== 0">
  10. <image class="advert_pic" @click="route_advert(list[activeIndex])" :src="list[activeIndex].advert_pic"
  11. v-if="list[activeIndex].advert_pic"></image>
  12. <view class="item dir-top-nowrap main-left cross-center" @click="route_go(it.page_url)" v-for="(it, key) in list[activeIndex].child" :key="key">
  13. <image :src="it.pic_url" class="pic_url"></image>
  14. <text class="name t-omit">{{it.name}}</text>
  15. </view>
  16. <view class="no-empty main-center" v-if="list[activeIndex].child.length === 0">
  17. <app-no-goods title="该分类下无相关内容哦~"></app-no-goods>
  18. </view>
  19. </scroll-view>
  20. <view class="no-empty main-center" v-else>
  21. <app-no-goods background="#f7f7f7" title="该分类下无相关内容哦~"></app-no-goods>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import appCategoryList from '../../components/page-component/app-category-list/app-category-list.vue';
  27. import appNoGoods from '../../components/page-component/app-no-goods/app-no-goods.vue';
  28. export default {
  29. name: "style-four",
  30. components: {
  31. 'app-category-list': appCategoryList,
  32. 'app-no-goods': appNoGoods,
  33. },
  34. props: [`list`, `activeIndex`, `setHeight`],
  35. methods: {
  36. active(item) {
  37. this.$emit('active', item);
  38. },
  39. route_go(data) {
  40. if (!data) return;
  41. uni.navigateTo({
  42. url: data
  43. });
  44. },
  45. route_advert(data) {
  46. this.$emit('route_advert', data);
  47. }
  48. }
  49. }
  50. </script>
  51. <style scoped lang="scss">
  52. .right {
  53. width: #{546rpx};
  54. background-color: #ffffff;
  55. }
  56. .advert_pic {
  57. width: #{500rpx};
  58. height: #{184rpx};
  59. margin: #{20rpx} #{24rpx} #{20rpx} #{24rpx};
  60. }
  61. .item {
  62. width: #{182rpx};
  63. height: #{138rpx};
  64. display: inline-block;
  65. margin-bottom: #{40rpx};
  66. text-align: center;
  67. }
  68. .pic_url {
  69. height: #{104rpx};
  70. width: #{104rpx};
  71. }
  72. .name {
  73. font-size: #{26rpx};
  74. margin-top: #{8rpx};
  75. line-height: 1;
  76. color: #353535;
  77. text-align: center;
  78. }
  79. .no-empty {
  80. width: 100%;
  81. margin-top: #{150upx};
  82. }
  83. </style>