index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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')">
  16. <!-- <image
  17. class="u-page__item__slot-icon"
  18. slot="active-icon"
  19. src="https://cdn.uviewui.com/uview/common/bell-selected.png"
  20. ></image>
  21. <image
  22. class="u-page__item__slot-icon"
  23. slot="inactive-icon"
  24. src="https://cdn.uviewui.com/uview/common/bell.png"
  25. ></image> -->
  26. </u-tabbar-item>
  27. <u-tabbar-item text="历史数据" icon="photo" name="history" @click="NavChange('history')" ></u-tabbar-item>
  28. <u-tabbar-item text="预警分析" icon="play-right" name="warndata" @click="NavChange('warndata')" ></u-tabbar-item>
  29. <u-tabbar-item text="操作记录" icon="account" name="people" @click="NavChange('people')" ></u-tabbar-item>
  30. </u-tabbar>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. PageCur: 'home',
  38. commponent1Key: 0,
  39. commponent2Key: 1,
  40. commponent3Key: 2,
  41. commponent4Key: 3,
  42. commponent5Key: 4,
  43. }
  44. },
  45. onLoad:function(){
  46. this.PageCur='home'
  47. },
  48. methods: {
  49. NavChange: function(e) {
  50. this.PageCur = e.currentTarget.dataset.cur
  51. }
  52. }
  53. }
  54. </script>
  55. <style>
  56. </style>