uniapp自定义tabbar


1,封装一个tabbar组件

2,正常编写官方的tabbar

3,在app.vue中的onShow中隐藏官方tabbar

4,会导致第一次加载闪屏

推荐使用官方tabbar

组件





页面组册引入


import Bars from '../../components/tabbar.vue';
components: {
    Bars
},

methods: {
 tab(e) {
    getApp().globalData.index = e
    if(e==1){
       uni.switchTab({
           url: '../classification/classification'
       })
    }else if(e==2){
       uni.switchTab({
         url: '../car/car'
       })
    }else if(e==3){
       uni.switchTab({
        url: '../me/me'
      })
    }
 }           
}

在app.vue中存储公共变量