diff --git a/src/components/CountTo/src/index.vue b/src/components/CountTo/src/index.vue index cc14c107..544b3fba 100644 --- a/src/components/CountTo/src/index.vue +++ b/src/components/CountTo/src/index.vue @@ -1,5 +1,5 @@ @@ -22,6 +22,7 @@ timestamp: number | null; rAF: any; remaining: number | null; + color: any; }>({ localStartVal: props.startVal, displayValue: formatNumber(props.startVal), @@ -32,6 +33,7 @@ timestamp: null, remaining: null, rAF: null, + color: null, }); onMounted(() => { @@ -52,10 +54,11 @@ }); function start() { - const { startVal, duration } = props; + const { startVal, duration, color } = props; state.localStartVal = startVal; state.startTime = null; state.localDuration = duration; + state.color = color; state.paused = false; state.rAF = requestAnimationFrame(count); } diff --git a/src/components/CountTo/src/props.ts b/src/components/CountTo/src/props.ts index 61ee12aa..33b35225 100644 --- a/src/components/CountTo/src/props.ts +++ b/src/components/CountTo/src/props.ts @@ -13,6 +13,10 @@ export const countToProps = { return value >= 0; }, }, + color: { + type: String as PropType, + require: false, + }, decimal: propTypes.string.def('.'), separator: propTypes.string.def(','), prefix: propTypes.string.def(''), diff --git a/src/views/demo/comp/count-to/index.vue b/src/views/demo/comp/count-to/index.vue index c8cfd136..86cdd9bd 100644 --- a/src/views/demo/comp/count-to/index.vue +++ b/src/views/demo/comp/count-to/index.vue @@ -2,16 +2,35 @@ - + - + - + - +