代码提交
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
<!-- 针对中间的导航栏 通过true来判断控制类名和样式 -->
|
||||
<view class="tabbar-item" v-for="(item, index) in tabbarList" :class="[item.centerItem ? 'center-item' : '']" @click="changeItem(item)" :key="index">
|
||||
<view class="item-top">
|
||||
<image :src="currentItem == item.id ? item.selectIcon : item.icon"></image>
|
||||
<image :src="currentItem == item.id ? item.selectIcon:item.icon"></image>
|
||||
</view>
|
||||
<!-- 通过三元判断控制类名 达到控制选中和未选中的样式 -->
|
||||
<view class="item-bottom" :class="[currentItem == item.id ? 'item-active' : '']">
|
||||
@ -31,8 +31,8 @@ export default {
|
||||
{
|
||||
id: 0,
|
||||
path: '/pages/index/index',
|
||||
icon: '/static/logo.png',
|
||||
selectIcon: '/static/logo.png',
|
||||
icon: '/static/indexB.png',
|
||||
selectIcon: '/static/indexA.png',
|
||||
text: '首页',
|
||||
centerItem: false
|
||||
},
|
||||
@ -48,8 +48,8 @@ export default {
|
||||
{
|
||||
id: 2,
|
||||
path: '/pages/person/person',
|
||||
icon: '/static/logo.png',
|
||||
selectIcon: '/static/logo.png',
|
||||
icon: '/static/personA.png',
|
||||
selectIcon: '/static/personB.png',
|
||||
text: '我的',
|
||||
centerItem: false
|
||||
}
|
||||
@ -58,13 +58,9 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.currentItem = this.currentPage
|
||||
// 隐藏原来的tabBar导航栏
|
||||
uni.hideTabBar()
|
||||
},
|
||||
methods: {
|
||||
changeItem (item) {
|
||||
let _this = this
|
||||
//_this.currentItem = item.id;
|
||||
uni.switchTab({
|
||||
url: item.path
|
||||
})
|
||||
@ -89,7 +85,7 @@ view {
|
||||
align-items: center;
|
||||
padding: 5rpx 0;
|
||||
color: #999999;
|
||||
|
||||
background: #131E3B;
|
||||
/* 针对tabbar的统一处理 */
|
||||
.tabbar-item {
|
||||
width: 33.33%;
|
||||
|
Reference in New Issue
Block a user