index.vue 1.3 KB

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