index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <page-meta>
  3. <navigation-bar :title="title" background-color="#FFFFFF" front-color="#000000" />
  4. </page-meta>
  5. <view v-if="!login">
  6. <login :login.sync='login' />
  7. </view>
  8. <view v-else>
  9. <!-- <home v-show="active=='home'" /> -->
  10. <applist v-show="active=='applist'" ref='applist' />
  11. <user v-show="active=='user'" />
  12. <van-tabbar :active="active" @change="onChange" :placeholder='true' active-color="#0F0404" inactive-color="#999999">
  13. <!-- <van-tabbar-item name='home'>
  14. <van-icon slot="icon" name="/static/imgs/fxh.png" />
  15. <van-icon slot="icon-active" name="/static/imgs/fx.png" />
  16. 首页
  17. </van-tabbar-item> -->
  18. <van-tabbar-item name='applist'>
  19. <van-icon slot="icon" name="/static/imgs/zth.png" />
  20. <van-icon slot="icon-active" name="/static/imgs/zt.png" />
  21. 发现
  22. </van-tabbar-item>
  23. <van-tabbar-item name='user'>
  24. <van-icon slot="icon" name="/static/imgs/wdh.png" />
  25. <van-icon slot="icon-active" name="/static/imgs/wd.png" />
  26. 我的
  27. </van-tabbar-item>
  28. </van-tabbar>
  29. </view>
  30. <van-toast id="van-toast" />
  31. </template>
  32. <script>
  33. import applist from './components/applist.vue'
  34. import find from './components/find/index.vue'
  35. import user from './components/user.vue'
  36. import topic from './components/topic/index.vue'
  37. import login from './components/login.vue'
  38. import home from './components/home.vue'
  39. export default {
  40. components: {
  41. applist,
  42. find,
  43. user,
  44. topic,
  45. login,
  46. home
  47. },
  48. data() {
  49. return {
  50. login: false,
  51. active: 'applist',
  52. }
  53. },
  54. onReachBottom() {
  55. if (this.active == 'applist') {
  56. this.$refs.applist.onBottom()
  57. }
  58. },
  59. computed: {
  60. title() {
  61. if (!this.login) return '登录'
  62. switch (this.active) {
  63. case 'home':
  64. return '首页';
  65. case 'applist':
  66. return '发现';
  67. case 'user':
  68. return '我的';
  69. }
  70. }
  71. },
  72. methods: {
  73. onChange(event) {
  74. // event.detail 的值为当前选中项的索引
  75. this.active = event.detail
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss">
  81. </style>