Skip to content

Commit bf418f2

Browse files
committed
feat: uni-goods-nav 组件添加角标前景色和背景色 dcloudio#139
1 parent 46d4c48 commit bf418f2

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

src/components/uni-goods-nav/readme.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@ export default {
7575

7676
**options 参数说明:**
7777

78-
|属性名 |类型 |默认值 |说明 |
79-
|--- |---- |--- |--- |
80-
|icon |String |- |显示图片,本地绝对路径或线上路径 |
81-
|text |String |- |显示文字 |
82-
|info |Number |0 |右上角数字角标 |
78+
|属性名 |类型 |默认值 |说明 |
79+
|--- |---- |--- |--- |
80+
|text |String |- |显示文字 |
81+
|info |Number |0 |右上角数字角标|
82+
|infoBackgroundColor|String |#ff0000|角标背景色|
83+
|infoColor |String |#fff |角标前景色|
8384

8485
**buttonGroup 参数说明:**
8586

8687
|属性名 |类型 |默认值 |说明 |
8788
|--- |---- |--- |--- |
8889
|text |String |- |按钮文字 |
89-
|background-color |String |- |按钮背景色 |
90+
|backgroundColor |String |- |按钮背景色 |
9091
|color |String |- |字体颜色 |
9192

9293
### 事件说明

src/components/uni-goods-nav/uni-goods-nav.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
<view class="uni-tab__cart-box flex">
66
<view class="flex uni-tab__cart-sub-left">
77
<view v-for="(item,index) in options" :key="index" class="flex uni-tab__cart-button-left uni-tab__shop-cart" @click="onClick(index,item)">
8-
<view class="uni-tab__icon">
8+
<view class="uni-tab__icon">
99
<uni-icons :type="item.icon" size="20" color="#646566"></uni-icons>
1010
<!-- <image class="image" :src="item.icon" mode="widthFix" /> -->
1111
</view>
1212
<text class="uni-tab__text">{{ item.text }}</text>
1313
<view class="flex uni-tab__dot-box">
14-
<text v-if="item.info" :class="{ 'uni-tab__dots': item.info > 9 }" class="uni-tab__dot ">{{ item.info }}</text>
14+
<text v-if="item.info" :class="{ 'uni-tab__dots': item.info > 9 }" class="uni-tab__dot " :style="{'backgroundColor':item.infoBackgroundColor?item.infoBackgroundColor:'#ff0000',
15+
color:item.infoColor?item.infoColor:'#fff'
16+
}">{{ item.info }}</text>
1517
</view>
1618
</view>
1719
</view>
1820
<view :class="{'uni-tab__right':fill}" class="flex uni-tab__cart-sub-right ">
1921
<view v-for="(item,index) in buttonGroup" :key="index" :style="{backgroundColor:item.backgroundColor,color:item.color}"
2022
class="flex uni-tab__cart-button-right" @click="buttonClick(index,item)"><text :style="{color:item.color}" class="uni-tab__cart-button-right-text">{{ item.text }}</text></view>
21-
<!-- <view class="flex uni-tab__cart-button-right uni-tab__color-y ">立即购买</view> -->
2223
</view>
2324
</view>
2425
</view>
@@ -48,7 +49,7 @@
4849
default () {
4950
return [{
5051
icon: 'shop',
51-
text: '店铺'
52+
text: '店铺',
5253
}, {
5354
icon: 'cart',
5455
text: '购物车'
@@ -131,7 +132,7 @@
131132
.uni-tab__right {
132133
margin: 5px 0;
133134
margin-right: 10px;
134-
border-radius: 100px;
135+
border-radius: 100px;
135136
overflow: hidden;
136137
}
137138

src/pages/nvue/goods-nav/goods-nav.nvue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@
2727
text: '客服'
2828
}, {
2929
icon: 'shop',
30-
text: '店铺'
30+
text: '店铺',
31+
info: 2,
32+
infoBackgroundColor:'#007aff',
33+
infoColor:"red"
3134
}, {
3235
icon: 'cart',
3336
text: '购物车',
3437
info: 2
3538
}],
3639
buttonGroup: [{
3740
text: '加入购物车',
38-
backgroundColor: '#ffa200 ',
41+
backgroundColor: '#ffa200',
3942
color: '#fff'
4043
},
4144
{

src/pages/vue/goods-nav/goods-nav.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@
2727
text: '客服'
2828
}, {
2929
icon: 'shop',
30-
text: '店铺'
30+
text: '店铺',
31+
info: 2,
32+
infoBackgroundColor:'#007aff',
33+
infoColor:"red"
3134
}, {
3235
icon: 'cart',
3336
text: '购物车',
3437
info: 2
3538
}],
3639
buttonGroup: [{
3740
text: '加入购物车',
38-
backgroundColor: '#ffa200 ',
41+
backgroundColor: '#ffa200',
3942
color: '#fff'
4043
},
4144
{

0 commit comments

Comments
 (0)