rtudata.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="wrap">
  3. <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
  4. @clickLeft="toBack">
  5. <view class="nav-title">
  6. <text>{{title}}</text>
  7. </view>
  8. </uni-nav-bar>
  9. <view class="container">
  10. <!-- 头部按钮 end -->
  11. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
  12. activeColor="#585b61"></uni-segmented-control>
  13. <view class="content">
  14. <view v-show="current === 0">
  15. <rturaindata></rturaindata>
  16. </view>
  17. <view v-show="current === 1">
  18. <rturiverdata></rturiverdata>
  19. </view>
  20. <view v-show="current === 2">
  21. <rtugrounddata></rtugrounddata>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import http from '@/http/api.js';
  29. import rtugrounddata from '@/pages/realdata/rtugrounddata.vue'
  30. import rturaindata from '@/pages/realdata/rturaindata.vue'
  31. import rturiverdata from '@/pages/realdata/rturiverdata.vue'
  32. export default {
  33. components: {
  34. rtugrounddata,
  35. rturaindata,
  36. rturiverdata,
  37. },
  38. data() {
  39. return {
  40. title: '实时数据',
  41. navButton: [],
  42. items: ['雨情数据', '水情数据', '墒情数据'],
  43. current: 0,
  44. };
  45. },
  46. onLoad() {
  47. const navBtnlist = [{
  48. name: '雨情数据',
  49. img: '/static/images/home/statistics.png',
  50. url: '/pages/rtu-manage/rturaindata'
  51. },
  52. {
  53. name: '水情数据',
  54. img: '/static/images/home/statistics.png',
  55. url: '/pages/rtu-manage/rturiverdata'
  56. },
  57. {
  58. name: '墒情数据',
  59. img: '/static/images/manage/statistics.png',
  60. url: '/pages/rtu-manage/rtugrounddata'
  61. }
  62. ];
  63. this.navButton = navBtnlist;
  64. },
  65. onShow() {
  66. },
  67. methods: {
  68. onClickItem(e) {
  69. if (this.current != e.currentIndex) {
  70. this.current = e.currentIndex;
  71. }
  72. },
  73. toBack() {
  74. uni.navigateBack({
  75. delta: 1
  76. })
  77. },
  78. }
  79. };
  80. </script>
  81. <style lang="scss">
  82. </style>