Skip to content

Commit e3c5744

Browse files
committed
Merge branch 'dev' into yiruiwen
2 parents c4ab4f7 + 8e8d97f commit e3c5744

File tree

6 files changed

+53
-17
lines changed

6 files changed

+53
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全
1919

2020
## [官方文档:https://www.uviewui.com](https://www.uviewui.com)
2121

22-
### [点击加群交流反馈:1129077272](https://qm.qq.com/cgi-bin/qm/qr?k=1FfucLpozYbnb7FWo_KsqAdEi1mE3Qrf&jump_from=webapi)
22+
### [点击加群交流反馈:1084514613](https://jq.qq.com/?_wv=1027&k=uyZUkSlo)
2323

2424
## 特性
2525

pages/componentsA/tabs/index.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<view class="u-demo-title">演示效果</view>
55
<view class="u-demo-area">
66
<u-toast ref="uToast"></u-toast>
7-
<u-tabs v-if="control" bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list"
8-
@change="change" :current="current" :is-scroll="isScroll"></u-tabs>
7+
<u-tabs v-if="control" bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list"
8+
@change="change" :current="current" :is-scroll="isScroll" :offset="offset"></u-tabs>
99
</view>
1010
</view>
1111
<view class="u-config-wrap">
@@ -38,9 +38,11 @@
3838
return {
3939
list: [],
4040
data: [{
41-
name: '关注'
41+
name: '关注',
42+
count: 100
4243
}, {
43-
name: '推荐'
44+
name: '推荐',
45+
count: 7
4446
}, {
4547
name: '电影'
4648
},{
@@ -62,7 +64,8 @@
6264
tabCountIndex: 0,
6365
activeColor: this.$u.color['primary'],
6466
bold: true,
65-
control: true
67+
control: true,
68+
offset: [5, -5]
6669
}
6770
},
6871
onLoad() {
@@ -75,17 +78,20 @@
7578
this.list = [];
7679
this.list.push(this.data[0]);
7780
this.list.push(this.data[1]);
81+
this.offset = [5, 60]
7882
} else if(index == 1) {
7983
this.list = [];
8084
this.list.push(this.data[0]);
8185
this.list.push(this.data[1]);
8286
this.list.push(this.data[2]);
87+
this.offset = [5, 20]
8388
} else {
8489
this.list = [];
8590
this.list.push(this.data[0]);
8691
this.list.push(this.data[1]);
8792
this.list.push(this.data[2]);
8893
this.list.push(this.data[3]);
94+
this.offset = [5, 5]
8995
}
9096
this.tabCountIndex = index;
9197
this.isScroll = false;
@@ -99,6 +105,7 @@
99105
if(index == 0) {
100106
this.isScroll = true;
101107
this.list = this.data;
108+
this.offset = [5, -5]
102109
} else {
103110
this.isScroll = false;
104111
this.countChange(this.tabCountIndex);
@@ -135,6 +142,6 @@
135142

136143
<style lang="scss" scoped>
137144
.u-config-wrap {
138-
145+
139146
}
140147
</style>

pages/template/order/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ export default {
278278
name: '待收货'
279279
},
280280
{
281-
name: '待评价'
281+
name: '待评价',
282+
count: 12
282283
}
283284
],
284285
current: 0,

uview-ui/components/u-rate/u-rate.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
:custom-prefix="customPrefix"
1313
:show-decimal-icon="showDecimalIcon(index)"
1414
:percent="decimal"
15-
:inactiveColor="inactiveColor"
15+
:inactive-color="inactiveColor"
1616
></u-icon>
1717
</view>
1818
</view>

uview-ui/components/u-tabs-swiper/u-tabs-swiper.vue

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<view class="u-tabs-scroll-box" :class="{'u-tabs-scorll-flex': !isScroll}">
88
<view class="u-tabs-item" :style="[tabItemStyle(index)]"
99
v-for="(item, index) in getTabs" :key="index" :class="[preId + index]" @tap="emit(index)">
10+
<u-badge :count="item[count] || item['count'] || 0" :offset="offset" size="mini"></u-badge>
1011
{{ item[name] || item['name']}}
1112
</view>
1213
<view v-if="showBar" class="u-scroll-bar" :style="[tabBarStyle]"></view>
@@ -18,9 +19,7 @@
1819
<script>
1920
import colorGradient from '../../libs/function/colorGradient';
2021
let color = colorGradient;
21-
const {
22-
windowWidth
23-
} = uni.getSystemInfoSync();
22+
const { windowWidth } = uni.getSystemInfoSync();
2423
const preId = 'UEl_';
2524
2625
/**
@@ -43,6 +42,8 @@
4342
* @property {String Number} gutter 单个tab标签的左右内边距之和,单位rpx(默认40)
4443
* @property {String} bg-color tabs导航栏的背景颜色(默认#ffffff)
4544
* @property {String} name 组件内部读取的list参数中的属性名,见官网说明(默认name)
45+
* @property {String} count 组件内部读取的list参数中的属性名(badge徽标数),同name属性的使用,见官网说明(默认count)
46+
* @property {Array} offset 设置badge徽标数的位置偏移,格式为 [x, y],也即设置的为top和right的值,单位rpx(默认[5, 20])
4647
* @property {Boolean} bold 激活选项的字体是否加粗(默认true)
4748
* @event {Function} change 点击标签时触发
4849
* @example <u-tabs-swiper ref="tabs" :list="list" :is-scroll="false"></u-tabs-swiper>
@@ -127,11 +128,23 @@
127128
type: String,
128129
default: 'window'
129130
},
130-
// 读取传入的数组对象的属性
131+
// 读取传入的数组对象的属性(tab名称)
131132
name: {
132133
type: String,
133134
default: 'name'
134135
},
136+
// 读取传入的数组对象的属性(徽标数)
137+
count: {
138+
type: String,
139+
default: 'count'
140+
},
141+
// 徽标数位置偏移
142+
offset: {
143+
type: Array,
144+
default: () => {
145+
return [5, 20]
146+
}
147+
},
135148
// 活动tab字体是否加粗
136149
bold: {
137150
type: Boolean,

uview-ui/components/u-tabs/u-tabs.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<view class="u-scroll-box" :class="{'u-tabs-scorll-flex': !isScroll}">
99
<view class="u-tab-item u-line-1" :id="'u-tab-item-' + index" v-for="(item, index) in list" :key="index" @tap="clickTab(index)"
1010
:style="[tabItemStyle(index)]">
11+
<u-badge :count="item[count] || item['count'] || 0" :offset="offset" size="mini"></u-badge>
1112
{{ item[name] || item['name']}}
1213
</view>
1314
<view v-if="showBar" class="u-tab-bar" :style="[tabBarStyle]"></view>
@@ -20,7 +21,7 @@
2021
<script>
2122
/**
2223
* tabs 标签
23-
* @description 该组件,是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
24+
* @description 该组件,是一个tabs标签组件,在标签多的时候,可以配置为左右滑动,标签少的时候,可以禁止滑动。 该组件的一个特点是配置为滚动模式时,激活的tab会自动移动到组件的中间位置。
2425
* @tutorial https://www.uviewui.com/components/tabs.html
2526
* @property {Boolean} is-scroll tabs是否可以左右拖动(默认true)
2627
* @property {Array} list 标签数组,元素为对象,如[{name: '推荐'}]
@@ -38,7 +39,9 @@
3839
* @property {String Number} item-width 标签的宽度(默认auto)
3940
* @property {String Number} gutter 单个tab标签的左右内边距之和,单位rpx(默认40)
4041
* @property {String} bg-color tabs导航栏的背景颜色(默认#ffffff)
41-
* @property {String} name 组件内部读取的list参数中的属性名,见官网说明(默认name)
42+
* @property {String} name 组件内部读取的list参数中的属性名(tab名称),见官网说明(默认name)
43+
* @property {String} count 组件内部读取的list参数中的属性名(badge徽标数),同name属性的使用,见官网说明(默认count)
44+
* @property {Array} offset 设置badge徽标数的位置偏移,格式为 [x, y],也即设置的为top和right的值,单位rpx(默认[5, 20])
4245
* @property {Boolean} bold 激活选项的字体是否加粗(默认true)
4346
* @event {Function} change 点击标签时触发
4447
* @example <u-tabs ref="tabs" :list="list" :is-scroll="false"></u-tabs>
@@ -108,11 +111,23 @@
108111
type: String,
109112
default: '#ffffff'
110113
},
111-
// 读取传入的数组对象的属性
114+
// 读取传入的数组对象的属性(tab名称)
112115
name: {
113116
type: String,
114117
default: 'name'
115118
},
119+
// 读取传入的数组对象的属性(徽标数)
120+
count: {
121+
type: String,
122+
default: 'count'
123+
},
124+
// 徽标数位置偏移
125+
offset: {
126+
type: Array,
127+
default: () => {
128+
return [5, 20]
129+
}
130+
},
116131
// 活动tab字体是否加粗
117132
bold: {
118133
type: Boolean,
@@ -290,7 +305,7 @@
290305

291306
<style lang="scss" scoped>
292307
@import "../../libs/css/style.components.scss";
293-
308+
294309
view,
295310
scroll-view {
296311
box-sizing: border-box;

0 commit comments

Comments
 (0)