For Tailwind CSS v3 docs, click here.

数字增长

向上或向下计数到目标数字的数字动画。

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/number-ticker.json"

手动安装

复制并粘贴以下代码:

NumberTicker.vue

API

Prop 名称类型默认值描述
valueint0Value to count to
directionup | downupDirection to count in
decimalPlacesnumber0Number of decimal places to show
delaynumber0Delay before counting (in milliseconds)
durationnumber1000Total duration for the entire animation (in milliseconds).
transitionTransitionPresetseaseOutCubicName of transition preset (https://vueuse.org/core/useTransition)

感谢