firstmodel.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view>
  3. <cu-custom><block slot="content">设备监控</block></cu-custom>
  4. <view scroll-x class="bg-white nav">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''" v-for="(item,index) in 4" :key="index" @tap="tabSelect" :data-id="index">
  7. Tab{{index}}
  8. </view>
  9. </view>
  10. </view>
  11. <scroll-view scroll-x class="bg-white nav">
  12. <view class="flex text-center">
  13. <view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''" v-for="(item,index) in 4" :key="index" @tap="tabSelect" :data-id="index">
  14. Tab{{index}}
  15. </view>
  16. </view>
  17. </scroll-view>
  18. <view class="main">
  19. <view class="card" v-for="(item,index) in 4" :key="index">
  20. Tab{{index}}
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. TabCur: 0,
  30. scrollLeft: 0
  31. };
  32. },
  33. methods: {
  34. tabSelect(e) {
  35. this.TabCur = e.currentTarget.dataset.id;
  36. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
  37. }
  38. }
  39. }
  40. </script>
  41. <style>
  42. .main{
  43. display: flex;
  44. flex-direction: column;
  45. }
  46. .card{
  47. margin: auto;
  48. margin-top: 20rpx;
  49. width: 90%;
  50. height: 280rpx;
  51. border:1rpx solid #000000;
  52. }
  53. </style>