index.vue 983 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view>
  3. <home :cur="PageCur" v-if="PageCur=='home'" :key="commponent1Key"></home>
  4. <people v-if="PageCur=='people'" :key="commponent2Key"></people>
  5. <view class="cu-bar tabbar bg-white shadow foot" style="z-index: 999;">
  6. <view :class="PageCur=='home'?'action text-green':'action text-gray'" @click="NavChange" data-cur="home">
  7. <view class='cuIcon-homefill'></view>主页
  8. </view>
  9. <view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange"
  10. data-cur="people">
  11. <view class='cuIcon-people'></view>个人
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. PageCur: 'home',
  21. commponent1Key: 0,
  22. commponent2Key: 0,
  23. }
  24. },
  25. onLoad: function() {
  26. this.PageCur = 'home'
  27. ++this.commponent1Key
  28. ++this.commponent2Key
  29. },
  30. methods: {
  31. NavChange: function(e) {
  32. this.PageCur = e.currentTarget.dataset.cur
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss">
  38. </style>