diff --git a/App.vue b/App.vue
index 65d1a44..a09ff03 100644
--- a/App.vue
+++ b/App.vue
@@ -117,6 +117,7 @@
+
diff --git a/uview-ui/components/u-tabs/u-tabs.vue b/uview-ui/components/u-tabs/u-tabs.vue
index 2d83f20..dd33244 100644
--- a/uview-ui/components/u-tabs/u-tabs.vue
+++ b/uview-ui/components/u-tabs/u-tabs.vue
@@ -7,11 +7,9 @@
+ :style="[tabItemStyle(index)]">
-
- {{ item[name] || item['name']}}
-
+ {{ item[name] || item['name']}}
@@ -168,9 +166,8 @@
scrollBarLeft: 0, // 移动bar需要通过translateX()移动的距离
parentLeft: 0, // 父元素(tabs组件)到屏幕左边的距离
id: this.$u.guid(), // id值
- currentIndex: 0,
+ currentIndex: this.current,
barFirstTimeMove: true, // 滑块第一次移动时(页面刚生成时),无需动画,否则给人怪异的感觉
- Checked:'Checked'
};
},
watch: {
@@ -178,7 +175,7 @@
// 后台获取的(如新闻app顶部的菜单),获取返回需要一定时间,所以list变化时,重新获取布局信息
list(n, o) {
// list变动时,重制内部索引,否则可能导致超出数组边界的情况
- if(n.length !== o.length){
+ if(n.length !== o.length) {
this.currentIndex = 0;
}else{
return;
@@ -202,13 +199,15 @@
computed: {
// 移动bar的样式
tabBarStyle() {
+ let scrollBarLeft = this.scrollBarLeft - 7;
let style = {
width: this.barWidth + 'rpx',
- transform: `translate(${this.scrollBarLeft}px, -100%)`,
+ transform: `translate(${scrollBarLeft}px, -100%)`,
// 滑块在页面渲染后第一次滑动时,无需动画效果
'transition-duration': `${this.barFirstTimeMove ? 0 : this.duration }s`,
'background-color': this.activeColor,
height: this.barHeight + 'rpx',
+ opacity: this.barFirstTimeMove ? 0 : 1,
// 设置一个很大的值,它会自动取能用的最大值,不用高度的一半,是因为高度可能是单数,会有小数出现
'border-radius': `${this.barHeight / 2}px`
};
@@ -253,15 +252,8 @@
},
// 点击某一个tab菜单
clickTab(index) {
- this.currentIndex = index;
- this.Checked = 'Checked';
- // // 点击当前活动tab,不触发事件
- // if(index == this.currentIndex){
- // this.Checked = 'Checked';
- // return ;
- // }else{
- // this.Checked = '';
- // };
+ // 点击当前活动tab,不触发事件
+ if(index == this.currentIndex) return ;
// 发送事件给父组件
this.$emit('change', index);
},
@@ -368,30 +360,21 @@
/* #endif */
text-align: center;
transition-property: background-color, color;
+ z-index: 2;
}
.u-tab-bar {
position: absolute;
- bottom: 0;
+ bottom: 10px;
+ width: 68rpx !important;
+ height: 10rpx !important;
+ background: #CFE7FD !important;
+ border-radius: 5rpx !important;
+ z-index: 1;
}
.u-tabs-scorll-flex {
@include vue-flex;
justify-content: space-between;
}
- .anniu{
- // padding:20rpx 58rpx;
- background-color: #F5F5F5;
- color: #555555;
- display: block;
- border-radius: 10rpx;
- margin-left:10rpx ;
- width: 172rpx;
- height: 80rpx;
- line-height: 80rpx;
- }
- .Checked{
- background-color: #FE9903;
- color: #FFFFFF;
- }