access-record.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="container">
  3. <view class="tabs" style="width: 420rpx;margin: 0rpx auto;padding-top: 20rpx;">
  4. <scroll-view scroll-x class="nav">
  5. <view class="flex text-center">
  6. <view style="border: 1rpx solid #5064eb;padding:15rpx 20rpx;" class="flex-sub"
  7. :class="index==current?'nav-checked':'nav-unchecked'" v-for="(item,index) in tabs" :key="index"
  8. @tap="tabChange(index)">
  9. {{item.name}}
  10. </view>
  11. </view>
  12. </scroll-view>
  13. </view>
  14. <view style="height: 100%;">
  15. <swiper style="height: 100%;" :current="current" @change="swiperChange" @animationfinish="animationfinish">
  16. <swiper-item v-for="(item,index) in tabs" :key="index">
  17. <scroll-view scroll-y style="height: 100%;">
  18. <item @showDetail="showDetail" :i="index" :item="item" :type="current"></item>
  19. </scroll-view>
  20. </swiper-item>
  21. </swiper>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import item from "./comps/item.vue"
  27. export default {
  28. components: {
  29. item
  30. },
  31. data() {
  32. return {
  33. scrollLeft: 0,
  34. current: 0,
  35. swiperCurrent: 0,
  36. tabs: [{
  37. name: '员工通行',
  38. value: 2
  39. },
  40. {
  41. name: '访客通行',
  42. value: 4
  43. }
  44. ],
  45. }
  46. },
  47. methods: {
  48. tabChange(index) {
  49. this.current = index
  50. },
  51. swiperChange(e) {
  52. uni.pageScrollTo({
  53. scrollTop: 0,
  54. duration: 0
  55. });
  56. this.current = e.detail.current
  57. },
  58. animationfinish({
  59. detail: {
  60. current
  61. }
  62. }) {
  63. this.swiperCurrent = current;
  64. this.current = current;
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .container {
  71. height: calc(100vh);
  72. background-color: #FFFFFF;
  73. padding: 100rpx 0rpx 0rpx;
  74. .tabs {
  75. height: 100rpx;
  76. position: fixed;
  77. top: 0rpx;
  78. left: 0;
  79. right: 0;
  80. width: 100%;
  81. z-index: 3;
  82. }
  83. }
  84. .nav-checked {
  85. background-color: $base-color;
  86. color: #FFFFFF;
  87. font-weight: 800;
  88. }
  89. .nav-unchecked {
  90. background-color: #FFFFFF;
  91. color: $base-color;
  92. }
  93. </style>