mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Progress): add track-color prop (#4789)
This commit is contained in:
parent
4c2cf8e2cb
commit
95598e8842
@ -68,6 +68,7 @@ Use `pivot-text` to custom text,use `color` to custom bar color
|
||||
| stroke-width | Stroke width | *string \| number* | `4px` | 2.2.1 |
|
||||
| show-pivot | Whether to show text | *boolean* | `true` | - |
|
||||
| color | Color | *string* | `#1989fa` | - |
|
||||
| text-color | Text color | *string* | `#fff` | - |
|
||||
| track-color | Track color | *string* | `#e5e5e5` | 2.2.9 |
|
||||
| pivot-text | Text | *string* | percentage | - |
|
||||
| pivot-color | Text background color | *string* | inherit progress color | - |
|
||||
| text-color | Text color | *string* | `#fff` | - |
|
||||
|
@ -71,6 +71,7 @@ Vue.use(Progress);
|
||||
| stroke-width | 进度条粗细,默认单位为`px` | *string \| number* | `4px` | 2.2.1 |
|
||||
| show-pivot | 是否显示进度文字 | *boolean* | `true` | - |
|
||||
| color | 进度条颜色 | *string* | `#1989fa` | - |
|
||||
| text-color | 进度条文字颜色 | *string* | `#fff` | - |
|
||||
| text-color | 进度文字颜色 | *string* | `#fff` | - |
|
||||
| track-color | 轨道颜色 | *string* | `#e5e5e5` | 2.2.9 |
|
||||
| pivot-text | 文字显示 | *string* | 百分比文字 | - |
|
||||
| pivot-color | 文字背景色 | *string* | 与进度条颜色一致 | - |
|
||||
|
@ -8,6 +8,7 @@ export default createComponent({
|
||||
inactive: Boolean,
|
||||
pivotText: String,
|
||||
pivotColor: String,
|
||||
trackColor: String,
|
||||
strokeWidth: [String, Number],
|
||||
percentage: {
|
||||
type: Number,
|
||||
@ -70,12 +71,10 @@ export default createComponent({
|
||||
width: (this.progressWidth * percentage) / 100 + 'px'
|
||||
};
|
||||
|
||||
let wrapperStyle;
|
||||
if (this.strokeWidth) {
|
||||
wrapperStyle = {
|
||||
height: addUnit(this.strokeWidth)
|
||||
};
|
||||
}
|
||||
const wrapperStyle = {
|
||||
background: this.trackColor,
|
||||
height: addUnit(this.strokeWidth)
|
||||
};
|
||||
|
||||
return (
|
||||
<div class={bem()} style={wrapperStyle}>
|
||||
|
@ -16,3 +16,13 @@ test('calc width', async () => {
|
||||
await later();
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('track color prop', async () => {
|
||||
const wrapper = mount(Progress, {
|
||||
propsData: {
|
||||
trackColor: 'green'
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.element.style.background).toEqual('green');
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user