index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view>
  3. <home v-show="current==0"></home>
  4. <my v-show="current==1"></my>
  5. <u-tabbar v-model="current" :list="list" active-color="#2F4379" :before-switch="beforeSwitch" ></u-tabbar>
  6. </view>
  7. </template>
  8. <script>
  9. import home from "@/components/home.vue"
  10. import my from "@/components/my.vue"
  11. import {mapState,mapMutations} from 'vuex';
  12. export default {
  13. components: {
  14. home,my
  15. },
  16. data() {
  17. return {
  18. list: [{
  19. iconPath: "/static/nav1.png",
  20. selectedIconPath: "/static/nav1_on.png",
  21. text: '学习中心',
  22. customIcon: false,
  23. },
  24. {
  25. iconPath: "/static/nav4.png",
  26. selectedIconPath: "/static/nav4_on.png",
  27. text: '我的',
  28. customIcon: false,
  29. },
  30. ],
  31. current:0
  32. }
  33. },
  34. onLoad(option) {
  35. },
  36. onShow(){
  37. },
  38. methods: {
  39. beforeSwitch(index) {
  40. let that = this
  41. if(index==this.current){
  42. return false
  43. }
  44. if(!this.$method.isLogin()){
  45. this.$navTo.togo('/pages/login/login');
  46. return false
  47. }else{
  48. return true
  49. }
  50. },
  51. },
  52. onReachBottom() {
  53. },
  54. onPullDownRefresh() {
  55. },
  56. computed: {...mapState(['login'])}
  57. }
  58. </script>
  59. <style scoped>
  60. </style>