Preview Updated 2026-05-10

Statistic

Large numeric display with thousand separators, prefix/suffix, and countdown. Common in dashboard headers.

Basic usage

When value is a number, thousand separators are applied automatically. precision controls decimal places. prefix / suffix add units on either side.

背景
今日访问
12,384
收入
¥84,520.42
转化率
3.2%
<script setup lang="ts">
import { CfStatistic } from '@chufix-design/vue';
</script>

<template>
  <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px;">
    <CfStatistic label="今日访问" :value="12384" />
    <CfStatistic label="收入" :value="84520.42" prefix="¥" :precision="2" />
    <CfStatistic label="转化率" :value="3.2" suffix="%" :precision="1" />
  </div>
</template>
<script setup>
import { CfStatistic } from '@chufix-design/vue';
</script>

<template>
  <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px;">
    <CfStatistic label="今日访问" :value="12384" />
    <CfStatistic label="收入" :value="84520.42" prefix="¥" :precision="2" />
    <CfStatistic label="转化率" :value="3.2" suffix="%" :precision="1" />
  </div>
</template>
<CfStatistic label="Today's visits" value={12384} />
<CfStatistic label="Revenue" value={84520.42} prefix="¥" precision={2} />
<CfStatistic label="Conversion" value={3.2} suffix="%" precision={1} />
<CfStatistic label="Today's visits" value={12384} />
<CfStatistic label="Revenue" value={84520.42} prefix="¥" precision={2} />
<CfStatistic label="Conversion" value={3.2} suffix="%" precision={1} />

API

PropTypeDefaultDescription
labelstringSmall label above the number
valuenumberMain number
precisionnumber0Decimal places
prefix / suffixstringUnits before/after the number
separatorstring','Thousand separator
decimalstring'.'Decimal character
durationnumber800Roll animation duration on value change (ms)
countdownnumber | Date | nullCountdown target timestamp / Date
formatstring'HH:mm:ss'Countdown format (supports DD / HH / mm / ss)
size'sm' | 'md' | 'lg''md'Number font size
loadingbooleanfalseLoading state, number slot shows

Events: onFinish (countdown mode only, fired when reaching zero).

反馈与讨论

Statistic · Discussion

0
0 / 600
一键发送
正在加载评论...