Skip to content

Commit 4135161

Browse files
committed
fix: progress trailColor not work #4483
close #4483
1 parent 257565b commit 4135161

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

components/progress/line.tsx

+17-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ export const handleGradient = strokeColor => {
5151
};
5252

5353
const Line = (_, { attrs, slots }) => {
54-
const { prefixCls, percent, successPercent, strokeWidth, size, strokeColor, strokeLinecap } =
55-
attrs;
54+
const {
55+
prefixCls,
56+
percent,
57+
successPercent,
58+
strokeWidth,
59+
size,
60+
strokeColor,
61+
strokeLinecap,
62+
trailColor,
63+
} = attrs;
5664
let backgroundProps;
5765
if (strokeColor && typeof strokeColor !== 'string') {
5866
backgroundProps = handleGradient(strokeColor);
@@ -61,6 +69,12 @@ const Line = (_, { attrs, slots }) => {
6169
background: strokeColor,
6270
};
6371
}
72+
73+
const trailStyle = trailColor
74+
? {
75+
style: { backgroundColor: trailColor },
76+
}
77+
: undefined;
6478
const percentStyle = {
6579
width: `${validProgress(percent)}%`,
6680
height: `${strokeWidth || (size === 'small' ? 6 : 8)}px`,
@@ -80,7 +94,7 @@ const Line = (_, { attrs, slots }) => {
8094
return (
8195
<div>
8296
<div class={`${prefixCls}-outer`}>
83-
<div class={`${prefixCls}-inner`}>
97+
<div class={`${prefixCls}-inner`} {...trailStyle}>
8498
<div class={`${prefixCls}-bg`} style={percentStyle} />
8599
{successSegment}
86100
</div>

0 commit comments

Comments
 (0)