Skip to content

Commit 9aef216

Browse files
committed
feat(button): 添加 loadingColor 属性支持自定义加载图标颜色
支持通过 loadingColor 属性自定义按钮加载图标的颜色,当未指定时保持原有逻辑 feat(button): 添加 loadingColor 属性支持自定义加载图标颜色
1 parent b7b1d5f commit 9aef216

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

packages/button/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
| loading-text | 加载状态提示文字 | _string_ | - |
137137
| loading-type | 加载状态图标类型,可选值为 `spinner` | _string_ | `circular` |
138138
| loading-size | 加载图标大小 | _string_ | `20px` |
139+
| loading-color | 加载图标颜色 | _string_ | - |
139140
| custom-style | 自定义样式 | _string_ | - |
140141
| open-type | 微信开放能力,具体支持可参考 [微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/button.html) | _string_ | - |
141142
| app-parameter | 打开 APP 时,向 APP 传递的参数 | _string_ | - |

packages/button/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ VantComponent({
5050
value: '20px',
5151
},
5252
color: String,
53+
loadingColor: String,
5354
},
5455

5556
methods: {

packages/button/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
custom-class="loading-class"
3535
size="{{ loadingSize }}"
3636
type="{{ loadingType }}"
37-
color="{{ computed.loadingColor({ type, color, plain }) }}"
37+
color="{{ computed.loadingColor({ loadingColor, type, color, plain }) }}"
3838
/>
3939
<view wx:if="{{ loadingText }}" class="van-button__loading-text">
4040
{{ loadingText }}

packages/button/index.wxs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function rootStyle(data) {
2222
}
2323

2424
function loadingColor(data) {
25+
if (data.loadingColor) {
26+
return data.loadingColor;
27+
}
28+
2529
if (data.plain) {
2630
return data.color ? data.color : '#c9c9c9';
2731
}

0 commit comments

Comments
 (0)