firstmodel.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view>
  3. <cu-custom><block slot="content">导航栏</block></cu-custom>
  4. <view scroll-x class="top-nav">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :current= 'currentTab' v-for="(item,index) in 4" :key="index" @tap="tabSelect" :data-id="index">
  7. Tab{{index}}
  8. </view>
  9. </view>
  10. <view class="flex text-center top-nav2" v-show="currentTab === 0">
  11. <view class="cu-item flex-sub" v-for="(item,index) in tab0data" :key="item.id" @tap="tabSelect" :data-id="item.id">
  12. {{item.name}}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="main">
  17. <view class="card" v-for="(item,index) in 4" :key="index">
  18. <H1>Tab{{index}}</H1>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. TabCur: 0,
  28. scrollLeft: 0,
  29. currentTab:0,
  30. tab0data:[
  31. {name:"测风装置",id:0},
  32. {name:"对射测风",id:1},
  33. {name:"单点测风",id:2},
  34. {name:"九点测风",id:3},
  35. ]
  36. };
  37. },
  38. methods: {
  39. tabSelect(e) {
  40. this.currentTab = e.currentTarget.dataset.id;
  41. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  42. }
  43. }
  44. }
  45. </script>
  46. <style>
  47. .top-nav{
  48. height: 100rpx;
  49. line-height: 100rpx;
  50. background-color: #2aa9f3;
  51. color: #daaaa;
  52. }
  53. .top-nav2{
  54. background-color:#ffffff
  55. }
  56. .main{
  57. margin-top: 100rpx;
  58. display: flex;
  59. flex-direction: column;
  60. }
  61. .card{
  62. background-color: #ffffff;
  63. margin: auto;
  64. margin-top: 20rpx;
  65. width: 90%;
  66. height: 280rpx;
  67. border:1rpx solid #000000;
  68. border-radius: 20rpx;
  69. }
  70. </style>