firstmodel.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. <view v-if="menushow" class="menupage">
  4. <DeviceMenu @menuClick="menuClick"></DeviceMenu>
  5. </view>
  6. <view v-if="!menushow" class="cu-form-group menubtn" @click="devicemenuShow">
  7. </view>
  8. <cu-custom><block slot="content">设备监控</block></cu-custom>
  9. <view v-show="!menushow" scroll-x class="top-nav">
  10. <view class="flex text-center">
  11. <view class="cu-item flex-sub" :current= 'currentTab' v-for="(item,index) in 4" :key="index" @tap="tabSelect" :data-id="index">
  12. Tab{{index}}
  13. </view>
  14. </view>
  15. <view class="flex text-center top-nav2" v-show="currentTab === 0">
  16. <view class="cu-item flex-sub" v-for="(item,index) in tab0data" :key="item.id" @tap="tabSelect" :data-id="item.id">
  17. {{item.name}}
  18. </view>
  19. </view>
  20. </view>
  21. <view v-show="!menushow" class="main">
  22. <view class="card" v-for="(item,index) in 4" :key="index">
  23. <H1>Tab{{index}}</H1>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import DeviceMenu from './devicemenu/devicemenu.vue'
  30. export default {
  31. data() {
  32. return {
  33. menushow:false,
  34. TabCur: 0,
  35. scrollLeft: 0,
  36. currentTab:0,
  37. tab0data:[
  38. {name:"测风装置",id:0},
  39. {name:"对射测风",id:1},
  40. {name:"单点测风",id:2},
  41. {name:"九点测风",id:3},
  42. ]
  43. };
  44. },
  45. components: {
  46. DeviceMenu,
  47. },
  48. methods: {
  49. tabSelect(e) {
  50. this.currentTab = e.currentTarget.dataset.id;
  51. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  52. },
  53. devicemenuShow(e){
  54. this.menushow = true;
  55. },
  56. menuClick(id){
  57. this.menushow = false;
  58. }
  59. }
  60. }
  61. </script>
  62. <style>
  63. .top-nav{
  64. height: 100rpx;
  65. line-height: 100rpx;
  66. background-color: #2aa9f3;
  67. color: #daaaa;
  68. }
  69. .top-nav2{
  70. background-color:#ffffff
  71. }
  72. .main{
  73. margin-top: 100rpx;
  74. display: flex;
  75. flex-direction: column;
  76. }
  77. .card{
  78. background-color: #ffffff;
  79. margin: auto;
  80. margin-top: 20rpx;
  81. width: 90%;
  82. height: 280rpx;
  83. border:1rpx solid #000000;
  84. border-radius: 20rpx;
  85. }
  86. .menupage{
  87. position: absolute;
  88. z-index: 2;
  89. top:40rpx;
  90. overflow-y: scroll;
  91. height: calc(100% - 40rpx);
  92. width: 100%;
  93. }
  94. .menubtn{
  95. position: absolute;
  96. z-index: 2;
  97. top:5rpx;
  98. left:5rpx;
  99. padding-left: 10rpx;
  100. background-color: #007BFF;
  101. border-radius: 10rpx;
  102. height: 40rpx;
  103. width: 40rpx;
  104. }
  105. </style>