Commit 8e8d97fe authored by TtTao's avatar TtTao

新增:tabs标签卡增加badge徽标数设置

parent 6a276a4a
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<view class="u-demo-title">演示效果</view> <view class="u-demo-title">演示效果</view>
<view class="u-demo-area"> <view class="u-demo-area">
<u-toast ref="uToast"></u-toast> <u-toast ref="uToast"></u-toast>
<u-tabs v-if="control" bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list" <u-tabs v-if="control" bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list"
@change="change" :current="current" :is-scroll="isScroll"></u-tabs> @change="change" :current="current" :is-scroll="isScroll" :offset="offset"></u-tabs>
</view> </view>
</view> </view>
<view class="u-config-wrap"> <view class="u-config-wrap">
...@@ -38,9 +38,11 @@ ...@@ -38,9 +38,11 @@
return { return {
list: [], list: [],
data: [{ data: [{
name: '关注' name: '关注',
count: 100
}, { }, {
name: '推荐' name: '推荐',
count: 7
}, { }, {
name: '电影' name: '电影'
},{ },{
...@@ -62,7 +64,8 @@ ...@@ -62,7 +64,8 @@
tabCountIndex: 0, tabCountIndex: 0,
activeColor: this.$u.color['primary'], activeColor: this.$u.color['primary'],
bold: true, bold: true,
control: true control: true,
offset: [5, -5]
} }
}, },
onLoad() { onLoad() {
...@@ -75,17 +78,20 @@ ...@@ -75,17 +78,20 @@
this.list = []; this.list = [];
this.list.push(this.data[0]); this.list.push(this.data[0]);
this.list.push(this.data[1]); this.list.push(this.data[1]);
this.offset = [5, 60]
} else if(index == 1) { } else if(index == 1) {
this.list = []; this.list = [];
this.list.push(this.data[0]); this.list.push(this.data[0]);
this.list.push(this.data[1]); this.list.push(this.data[1]);
this.list.push(this.data[2]); this.list.push(this.data[2]);
this.offset = [5, 20]
} else { } else {
this.list = []; this.list = [];
this.list.push(this.data[0]); this.list.push(this.data[0]);
this.list.push(this.data[1]); this.list.push(this.data[1]);
this.list.push(this.data[2]); this.list.push(this.data[2]);
this.list.push(this.data[3]); this.list.push(this.data[3]);
this.offset = [5, 5]
} }
this.tabCountIndex = index; this.tabCountIndex = index;
this.isScroll = false; this.isScroll = false;
...@@ -99,6 +105,7 @@ ...@@ -99,6 +105,7 @@
if(index == 0) { if(index == 0) {
this.isScroll = true; this.isScroll = true;
this.list = this.data; this.list = this.data;
this.offset = [5, -5]
} else { } else {
this.isScroll = false; this.isScroll = false;
this.countChange(this.tabCountIndex); this.countChange(this.tabCountIndex);
...@@ -135,6 +142,6 @@ ...@@ -135,6 +142,6 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.u-config-wrap { .u-config-wrap {
} }
</style> </style>
...@@ -278,7 +278,8 @@ export default { ...@@ -278,7 +278,8 @@ export default {
name: '待收货' name: '待收货'
}, },
{ {
name: '待评价' name: '待评价',
count: 12
} }
], ],
current: 0, current: 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment