Skip to content

Commit

Permalink
fix(statistic): fix with missing default precision in animation (#3650)
Browse files Browse the repository at this point in the history
  • Loading branch information
oljc authored Dec 1, 2023
1 parent 470a2be commit c709bfa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/statistic/statistic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export default defineComponent({
};
const numberValue = computed(() => (isNumber(props.value) ? props.value : 0));
const innerValue = ref(props.animation?.valueFrom ?? props.value);
const innerDecimalPlaces = computed(
() => props.decimalPlaces ?? numberValue.value.toString().split('.')[1]?.length ?? 0,
);

const tween = ref<Tween>();
const { value } = toRefs(props);
Expand All @@ -46,7 +49,7 @@ export default defineComponent({
},
duration: props.animation.duration,
onUpdate: (keys) => {
innerValue.value = keys.value;
innerValue.value = Number(keys.value.toFixed(innerDecimalPlaces.value));
},
onFinish: () => {
innerValue.value = to;
Expand Down

0 comments on commit c709bfa

Please sign in to comment.