Skip to content

Statistic 统计组件

Statistic 用于突出展示统计数值、金额、排名等数据。VISTA B 直接使用 Element Plus 的 el-statistic,需要倒计时时使用 el-countdown

基础用法

用于突出某个或某组数字时,数值和标题前后都可以加入图标、单位等元素。需要数值变化动效时,可结合 VueUse 等工具处理输入值。

Daily active users
268,500
Ratio of men to women
138
/100
Total Transactions
172,000
Feedback number
562
vue
<el-statistic title="Daily active users" :value="268500" />

<el-statistic :value="138">
  <template #title>
    <div>
      Ratio of men to women
      <el-icon><Male /></el-icon>
    </div>
  </template>
  <template #suffix>/100</template>
</el-statistic>

格式化数值

通过 precisiondecimal-separatorgroup-separatorprefixsuffixvalue-style 可以控制数值展示格式。

Rental revenue
$
98,642.57
Completion rate
86.6
%
vue
<el-statistic
  title="Rental revenue"
  :value="98642.57"
  :precision="2"
  prefix="$"
/>

倒计时

Countdown 用于展示剩余时间,支持自定义标题、格式和控制按钮。

Start to grab
00:00:00
Remaining VIP time
00:00:00
未完成
Still to go until next month
00 days 00:00:00
2026-06-01
vue
<script setup>
import { ref } from 'vue'

const value = ref(Date.now() + 1000 * 60 * 60 * 7)
</script>

<template>
  <el-countdown title="Start to grab" :value="value" />
  <el-countdown format="DD [days] HH:mm:ss" :value="value" />
</template>

TIP

倒计时格式化时,建议在天数范围内使用,避免过长周期导致展示含义不清。

统计卡片

统计卡片适合在数据看板中组合展示标题、数值、趋势和说明信息。

Daily active users
98,500
Monthly Active Users
693,700
New transactions today
72,000
vue
<div class="statistic-card">
  <el-statistic :value="98500">
    <template #title>
      <div>Daily active users</div>
    </template>
  </el-statistic>
  <div class="statistic-footer">
    <span>than yesterday</span>
    <span>24%</span>
  </div>
</div>

Statistic API

Statistic 属性

属性说明类型默认值
value数字内容number / Dayjs0
decimal-separator设置小数点符号string.
formatter自定义数字格式化Function
group-separator设置千分位标识符string,
precision数字精度number0
prefix设置数字前缀string
suffix设置数字后缀string
title数字标题string
value-style数字样式string / object / array

Statistic 插槽

插槽名说明
title数字标题
prefix数字内容之前
suffix数字内容之后

Statistic 暴露

名称说明类型
displayValue当前显示值ComputedRef<string | number | Dayjs>

Countdown API

Countdown 属性

属性说明类型默认值
value目标时间number / Dayjs0
format格式化倒计时stringHH:mm:ss
prefix设置倒计时前缀string
suffix设置倒计时后缀string
title倒计时标题string
value-style倒计时值样式string / object / array

Countdown 事件

事件名说明类型
change时间差改变时触发(value: number) => void
finish倒计时结束时触发() => void

Countdown 插槽

插槽名说明
title倒计时标题
prefix倒计时值前缀
suffix倒计时值后缀

Countdown 暴露

名称说明类型
displayValue当前显示值ComputedRef<string>

使用提醒

统计组件适合展示关键指标,不适合承载复杂明细。数据看板中建议保持同一行指标的口径一致,并在需要时通过 Tooltip 说明统计口径。

HOMEVISTA 设计规范