index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!-- 货源 -->
  2. <template>
  3. <view class="content">
  4. <view class="head flex flex-space-evenly">
  5. <view class="flex">
  6. <view>装</view>
  7. <view @click="changeCity(0)">营口</view>
  8. <view>></view>
  9. </view>
  10. <view>-------></view>
  11. <view class="flex">
  12. <view>卸</view>
  13. <view @click="changeCity(1)">全国</view>
  14. <view>></view>
  15. </view>
  16. </view>
  17. <me-tabs v-model="tabIndex" :tabs="tabs" class="m-topr20"></me-tabs>
  18. <swiper :style="{height: height}" :current="tabIndex" @change="swiperChange">
  19. <swiper-item v-for="(tab,i) in tabs" :key="i">
  20. <mescroll-item ref="mescrollItem" :i="i" :index="tabIndex" :tabs="tabs" :height="height">
  21. </mescroll-item>
  22. </swiper-item>
  23. </swiper>
  24. </view>
  25. </template>
  26. <script>
  27. import MescrollItem from "./mescroll-swiper-item.vue";
  28. export default {
  29. components: {
  30. MescrollItem
  31. },
  32. data() {
  33. return {
  34. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  35. height: "", // 需要固定swiper的高度
  36. tabs: [{name:'推荐'}, {name:'按时间'}, {name:'按距离'}, {name:'运费先付'}],
  37. tabIndex: 0 // 当前tab的下标
  38. }
  39. },
  40. onLoad() {
  41. let _isHave = this.$utils.getRoles('aaa')
  42. console.log(_isHave)
  43. // 需要固定swiper的高度 (需减去悬浮tabs的高度64rpx)
  44. this.height = uni.getSystemInfoSync().windowHeight - uni.upx2px(64) + 'px'
  45. },
  46. methods: {
  47. changeCity(type) {
  48. console.log(type)
  49. },
  50. swiperChange(e) {
  51. this.tabIndex = e.detail.current
  52. }
  53. }
  54. }
  55. </script>
  56. <style scoped lang="scss">
  57. </style>