index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. <camera :cur="PageCur" v-if="PageCur=='camera'" :key="commponent5Key"></camera>
  8. <u-tabbar
  9. :value="PageCur"
  10. @change="name => PageCur = name"
  11. :fixed="true"
  12. :placeholder="true"
  13. :safeAreaInsetBottom="true"
  14. >
  15. <u-tabbar-item text="设备监测" name="home" icon="file-text" @click="NavChange('home')"></u-tabbar-item>
  16. <u-tabbar-item text="历史数据" icon="home" name="history" @click="NavChange('history')" ></u-tabbar-item>
  17. <u-tabbar-item text="预警分析" icon="play-right" name="warndata" @click="NavChange('warndata')" ></u-tabbar-item>
  18. <u-tabbar-item text="操作记录" icon="account" name="people" @click="NavChange('people')" ></u-tabbar-item>
  19. </u-tabbar>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. PageCur: 'home',
  27. commponent1Key: 0,
  28. commponent2Key: 1,
  29. commponent3Key: 2,
  30. commponent4Key: 3,
  31. commponent5Key: 4,
  32. }
  33. },
  34. onLoad:function(){
  35. this.PageCur='home'
  36. },
  37. methods: {
  38. NavChange: function(e) {
  39. this.PageCur = e
  40. }
  41. }
  42. }
  43. </script>
  44. <style>
  45. </style>