|
|
@ -5,8 +5,9 @@ |
|
|
<view class="tabbar-box"> |
|
|
<view class="tabbar-box"> |
|
|
<view class="tab-item" |
|
|
<view class="tab-item" |
|
|
:class="{'tab-active': currentTabBar == index}" |
|
|
:class="{'tab-active': currentTabBar == index}" |
|
|
:style="{'width': 100 / tabbars.length +'%'}" |
|
|
|
|
|
|
|
|
:style="{'width': 100 / show_count +'%'}" |
|
|
@click="clickTab(item, index)" |
|
|
@click="clickTab(item, index)" |
|
|
|
|
|
v-if="item.show" |
|
|
v-for="(item, index) in tabbars" :key="index"> |
|
|
v-for="(item, index) in tabbars" :key="index"> |
|
|
<view class="tab-icon"> |
|
|
<view class="tab-icon"> |
|
|
<text class="lf-font-40 lf-iconfont" :class="item.icon"></text> |
|
|
<text class="lf-font-40 lf-iconfont" :class="item.icon"></text> |
|
|
@ -29,7 +30,7 @@ |
|
|
}, |
|
|
}, |
|
|
data(){ |
|
|
data(){ |
|
|
return { |
|
|
return { |
|
|
|
|
|
|
|
|
|
|
|
show_count: 0 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -42,11 +43,16 @@ |
|
|
let tabbars = this.tabbars; |
|
|
let tabbars = this.tabbars; |
|
|
let tabbar_name = tabbars[this.currentTabBar].path; |
|
|
let tabbar_name = tabbars[this.currentTabBar].path; |
|
|
let current = 0; |
|
|
let current = 0; |
|
|
|
|
|
let show_count = 0; |
|
|
tabbars.map((item, index) => { |
|
|
tabbars.map((item, index) => { |
|
|
if(item.path == '/'+ page){ |
|
|
if(item.path == '/'+ page){ |
|
|
current = index; |
|
|
current = index; |
|
|
} |
|
|
} |
|
|
|
|
|
if(item.show){ |
|
|
|
|
|
show_count++; |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.show_count = show_count; |
|
|
if(tabbar_name != '/'+ page){ |
|
|
if(tabbar_name != '/'+ page){ |
|
|
this.$store.commit('setCurrentTabBar', current); |
|
|
this.$store.commit('setCurrentTabBar', current); |
|
|
} |
|
|
} |
|
|
|