index.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. console.log("登录成功,进入首页")
  27. this.PageCur = 'home'
  28. ++this.commponent1Key
  29. ++this.commponent2Key
  30. },
  31. methods: {
  32. NavChange: function(e) {
  33. this.PageCur = e.currentTarget.dataset.cur
  34. }
  35. }
  36. }
  37. </script>
  38. <style lang="scss">
  39. </style>