[Improvement] Progress: support gradient color (#1098)

This commit is contained in:
neverland
2018-05-18 14:28:33 +08:00
committed by GitHub
parent e9508262b7
commit eee44f0d7c
8 changed files with 87 additions and 56 deletions
+23 -11
View File
@@ -14,18 +14,14 @@ Vue.use(Progress);
进度条默认为蓝色,使用`percentage`属性来设置当前进度
```html
<van-progress :percentage="0" />
<van-progress :percentage="46" />
<van-progress :percentage="100" />
<van-progress :percentage="50" />
```
#### 进度条置灰
#### 置灰
```html
<van-progress inactive :percentage="0" />
<van-progress inactive :percentage="46" />
<van-progress inactive :percentage="100" />
<van-progress inactive :percentage="50" />
```
@@ -34,9 +30,24 @@ Vue.use(Progress);
可以使用`pivot-text`属性自定义文字,`color`属性自定义进度条颜色
```html
<van-progress pivot-text="红色" color="#ed5050" :percentage="26" />
<van-progress pivot-text="橙色" color="#f60" :percentage="46" />
<van-progress pivot-text="黄色" color="#f09000" :percentage="66" />
<van-progress
pivot-text="橙色"
color="#f2826a"
:percentage="25"
/>
<van-progress
pivot-text="红色"
color="#f3594b"
:percentage="50"
/>
<van-progress
:percentage="75"
pivot-text="紫色"
pivot-color="#7232dd"
color="linear-gradient(to right, #be99ff, #7232dd)"
/>
```
### API
@@ -46,6 +57,7 @@ Vue.use(Progress);
| inactive | 是否置灰 | `Boolean` | `false` |
| percentage | 进度百分比 | `Number` | `false` |
| show-pivot | 是否显示进度文字 | `Boolean` | `true` |
| pivot-text | 文字显示 | `String` | 百分比文字 |
| color | 进度条颜色 | `String` | `#38f` |
| text-color | 进度条文字颜色 | `String` | `#fff` |
| pivot-text | 文字显示 | `String` | 百分比文字 |
| pivot-color | 文字背景色 | `String` | 与进度条颜色一致 |