diff --git a/packages/tabbar-item/index.less b/packages/tabbar-item/index.less index a4d2afbf..096526c2 100644 --- a/packages/tabbar-item/index.less +++ b/packages/tabbar-item/index.less @@ -1,7 +1,10 @@ @import '../common/style/var.less'; +:host { + flex: 1; +} + .van-tabbar-item { - float: left; color: #666; height: 100%; display: flex; diff --git a/packages/tabbar-item/index.ts b/packages/tabbar-item/index.ts index 37266664..afefd434 100644 --- a/packages/tabbar-item/index.ts +++ b/packages/tabbar-item/index.ts @@ -13,8 +13,7 @@ VantComponent({ }, data: { - active: false, - count: 0 + active: false }, methods: { @@ -26,10 +25,9 @@ VantComponent({ this.$emit('click'); }, - setActive(data) { - const { active, count } = this.data; - if (active !== data.active || count !== data.count) { - this.setData(data); + setActive(active) { + if (this.data.active !== active) { + this.setData({ active }); } } } diff --git a/packages/tabbar-item/index.wxml b/packages/tabbar-item/index.wxml index d888e740..cdcd3df3 100644 --- a/packages/tabbar-item/index.wxml +++ b/packages/tabbar-item/index.wxml @@ -1,6 +1,5 @@ diff --git a/packages/tabbar/index.less b/packages/tabbar/index.less index 724726a1..3fd7e4fc 100644 --- a/packages/tabbar/index.less +++ b/packages/tabbar/index.less @@ -3,7 +3,8 @@ .van-tabbar { width: 100%; height: 50px; - background-color: #fff; + display: flex; + background-color: @white; &--fixed { left: 0; diff --git a/packages/tabbar/index.ts b/packages/tabbar/index.ts index d9f4a3ca..bc44e527 100644 --- a/packages/tabbar/index.ts +++ b/packages/tabbar/index.ts @@ -49,10 +49,7 @@ VantComponent({ methods: { setActiveItem() { this.data.items.forEach((item, index) => { - item.setActive({ - active: index === this.data.currentActive, - count: this.data.items.length - }); + item.setActive(index === this.data.currentActive); }); },