index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view>
  3. <home :cur="PageCur" v-if="PageCur=='home'" :key="commponent1Key"></home>>
  4. <history :cur="PageCur" v-if="PageCur=='history'" :key="commponent2Key"></history>
  5. <warndata :cur="PageCur" v-if="PageCur=='warndata'" :key="commponent3Key"></warndata>
  6. <people v-if="PageCur=='people'" :key="commponent4Key"></people>
  7. <view class="cu-bar tabbar bg-white shadow foot">
  8. <view :class="PageCur=='home'?'action text-green':'action text-gray'" @click="NavChange" data-cur="home">
  9. <view class='cuIcon-homefill'></view>设备监测
  10. </view>
  11. <view :class="PageCur=='history'?'action text-green':'action text-gray'" @click="NavChange" data-cur="history">
  12. <view class='cuIcon-peoplelist'></view>历史数据
  13. </view>
  14. <view :class="PageCur=='warndata'?'action text-green':'action text-gray'" @click="NavChange" data-cur="warndata">
  15. <view class='cuIcon-profile'></view>预警分析
  16. </view>
  17. <view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange" data-cur="people">
  18. <view class='cuIcon-people'></view>个人信息
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. PageCur: 'home',
  28. commponent1Key: 0,
  29. commponent2Key: 0,
  30. commponent3Key: 0,
  31. commponent4Key: 0,
  32. }
  33. },
  34. onLoad:function(){
  35. this.PageCur='home'
  36. ++this.commponent1Key
  37. ++this.commponent2Key
  38. ++this.commponent3Key
  39. ++this.commponent4Key
  40. },
  41. methods: {
  42. NavChange: function(e) {
  43. this.PageCur = e.currentTarget.dataset.cur
  44. }
  45. }
  46. }
  47. </script>
  48. <style>
  49. </style>