import{o as t,c as n,a}from"./app.c38d1953.js";const s='{"title":"CountTo 数字动画组件","description":"","frontmatter":{},"headers":[{"level":2,"title":"用法","slug":"用法"},{"level":2,"title":"CountTo 属性","slug":"countto-属性"}],"relativePath":"components/count-to.md","lastUpdated":1721206001124}',e={},o=a('
基于 vue-count-to
改造
CountTo 组件位于 src/components/CountTo 内
更复杂点的例子,请在线预览
<script setup lang="ts">\nimport { CountTo } from '@/components/CountTo'\n</script>\n\n<template>\n <CountTo :start-val="0" :end-val="35225" />\n</template>\n\n
属性 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
startVal | 初始值 | number | - | 0 |
endVal | 最后展示的值 | number | - | 2021 |
duration | 动画时间 | number | - | 3000 |
autoplay | 是否自动播放 | boolean | - | true |
decimals | 小位数 | number | - | 0 |
decimal | 小位数分割符号 | string | - | . |
separator | 分割符号 | string | - | , |
prefix | 前缀 | string | - | - |
suffix | 后缀 | string | - | - |
useEasing | 过渡动画 | boolean | - | true |
easingFn | 自定义动画效果 | (t: number, b: number, c: number, d: number) => number | - | - |