fix: progress trailColor not work #4483

close #4483
pull/4499/head
tangjinzhou 2021-08-08 15:03:52 +08:00
parent 257565b29d
commit 4135161173
2 changed files with 18 additions and 4 deletions

View File

@ -51,8 +51,16 @@ export const handleGradient = strokeColor => {
};
const Line = (_, { attrs, slots }) => {
const { prefixCls, percent, successPercent, strokeWidth, size, strokeColor, strokeLinecap } =
attrs;
const {
prefixCls,
percent,
successPercent,
strokeWidth,
size,
strokeColor,
strokeLinecap,
trailColor,
} = attrs;
let backgroundProps;
if (strokeColor && typeof strokeColor !== 'string') {
backgroundProps = handleGradient(strokeColor);
@ -61,6 +69,12 @@ const Line = (_, { attrs, slots }) => {
background: strokeColor,
};
}
const trailStyle = trailColor
? {
style: { backgroundColor: trailColor },
}
: undefined;
const percentStyle = {
width: `${validProgress(percent)}%`,
height: `${strokeWidth || (size === 'small' ? 6 : 8)}px`,
@ -80,7 +94,7 @@ const Line = (_, { attrs, slots }) => {
return (
<div>
<div class={`${prefixCls}-outer`}>
<div class={`${prefixCls}-inner`}>
<div class={`${prefixCls}-inner`} {...trailStyle}>
<div class={`${prefixCls}-bg`} style={percentStyle} />
{successSegment}
</div>

2
v2-doc

@ -1 +1 @@
Subproject commit 1882ee4e30b707551a08561f090e72a3f261f6cf
Subproject commit 157cce105e1f0a369658dfb29cc802ebc09d0d93