list.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="container">
  3. <view class="tabs">
  4. <scroll-view scroll-x class="bg-white nav">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold ':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
  7. {{item.name}}
  8. </view>
  9. </view>
  10. </scroll-view>
  11. </view>
  12. <view style="height: 100%;">
  13. <swiper style="height: 100%;" :current="current" @change="swiperChange"
  14. @animationfinish="animationfinish">
  15. <swiper-item v-for="(item, index) in tabs" :key="index">
  16. <scroll-view scroll-y style="height: 100%;">
  17. <item ref="mescrollItem" :i="index" :item="item" :type="current"></item>
  18. </scroll-view>
  19. </swiper-item>
  20. </swiper>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import item from "./comps/item.vue"
  26. export default {
  27. components: {
  28. item
  29. },
  30. data() {
  31. return {
  32. current: 0,
  33. swiperCurrent:0,
  34. tabs: [
  35. {
  36. name: '待发货',
  37. value:0
  38. },
  39. {
  40. name: '已发货',
  41. value:1
  42. },
  43. {
  44. name:'已完成',
  45. value:2
  46. }
  47. ],
  48. }
  49. },
  50. onLoad() {
  51. },
  52. methods:{
  53. tabChange(index) {
  54. this.current = index
  55. },
  56. swiperChange(e) {
  57. uni.pageScrollTo({
  58. scrollTop: 0,
  59. duration: 0
  60. });
  61. this.current = e.detail.current
  62. },
  63. animationfinish({detail: { current }}) {
  64. this.swiperCurrent = current;
  65. this.current = current;
  66. },
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .text-blue{
  72. color:#5a3ee8
  73. }
  74. .text-xl{
  75. font-size: 34rpx;
  76. }
  77. .container {
  78. height: calc(100vh);
  79. background-color: #F6F6F6;
  80. padding: 78rpx 0rpx 0rpx;
  81. .tabs {
  82. position: fixed;
  83. top: -10rpx;
  84. left: 0;
  85. width: 100%;
  86. background-color: #FFFFFF;
  87. box-sizing: border-box;
  88. z-index: 3;
  89. }
  90. }
  91. </style>