index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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-if="activeObj.home" v-show="active=='home'" />
  10. <cinema v-if="activeObj.cinema" v-show="active=='cinema'" />
  11. <applist v-if="activeObj.applist" v-show="active=='applist'" ref='applist' />
  12. <user v-if="activeObj.user" v-show="active=='user'" />
  13. <van-tabbar :active="active" @change="onChange" :placeholder='true' active-color="#E31818" inactive-color="#999999">
  14. <van-tabbar-item name='home' icon='home-o'>
  15. <!-- <van-icon slot="icon" name="/static/imgs/fxh.png" /> -->
  16. <!-- <van-icon slot="icon-active" name="/static/imgs/fx.png" /> -->
  17. 首页
  18. </van-tabbar-item>
  19. <van-tabbar-item name='cinema' icon='video-o'>
  20. <!-- <van-icon slot="icon" name="/static/imgs/fxh.png" /> -->
  21. <!-- <van-icon slot="icon-active" name="/static/imgs/fx.png" /> -->
  22. 电影
  23. </van-tabbar-item>
  24. <van-tabbar-item name='applist' icon='search'>
  25. <!-- <van-icon slot="icon" name="/static/imgs/zth.png" /> -->
  26. <!-- <van-icon slot="icon-active" name="/static/imgs/zt.png" /> -->
  27. 发现
  28. </van-tabbar-item>
  29. <van-tabbar-item name='user' icon='user-o'>
  30. <!-- <van-icon slot="icon" name="/static/imgs/wdh.png" /> -->
  31. <!-- <van-icon slot="icon-active" name="/static/imgs/wd.png" /> -->
  32. 我的
  33. </van-tabbar-item>
  34. </van-tabbar>
  35. </view>
  36. <van-toast id="van-toast" />
  37. </template>
  38. <script>
  39. import applist from './components/applist.vue'
  40. import find from './components/find/index.vue'
  41. import user from './components/user.vue'
  42. import topic from './components/topic/index.vue'
  43. import login from './components/login.vue'
  44. import home from './components/home.vue'
  45. import cinema from './components/cinema.vue'
  46. export default {
  47. components: {
  48. applist,
  49. find,
  50. user,
  51. topic,
  52. login,
  53. home,
  54. cinema
  55. },
  56. data() {
  57. return {
  58. login: false,
  59. active: 'home',
  60. activeObj: {
  61. home: true
  62. },
  63. }
  64. },
  65. onReachBottom() {
  66. if (this.active == 'applist') {
  67. this.$refs.applist.onBottom()
  68. }
  69. },
  70. computed: {
  71. title() {
  72. if (!this.login) return '登录'
  73. switch (this.active) {
  74. case 'home':
  75. return '首页';
  76. case 'cinema':
  77. return '电影';
  78. case 'applist':
  79. return '发现';
  80. case 'user':
  81. return '我的';
  82. }
  83. }
  84. },
  85. methods: {
  86. onChange(event) {
  87. // event.detail 的值为当前选中项的索引
  88. this.active = event.detail
  89. this.activeObj[this.active] = true
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. </style>