Skip to content

LCountTo ​

组件属性 ​

属性名说明类型默认值必填验证规则
startVal起始值number0否-
endVal结束值number2017否-
duration动画持续时间(毫秒)number3000否-
autoplay是否自动播放booleantrue否-
decimals小数位数number0否必须 >= 0
decimal小数点符号string'.'否-
separator千分位分隔符string','否不能是数字
prefix前缀string''否-
suffix后缀string''否-
useEasing是否使用缓动函数booleantrue否-
easingFn自定义缓动函数Function默认函数否-

组件事件 ​

事件名说明回调参数
mountedCallback组件挂载后触发-
callback动画完成后触发-

组件方法 ​

通过组件 ref 调用:

方法名说明
start()开始/重新开始动画
pause()暂停动画
resume()恢复动画
reset()重置到初始状态
pauseResume()切换暂停/恢复状态

组件示例 ​

loading

组件使用 ​

vue
<template>
  <LCountTo
    :start-val="0"
    :end-val="5000"
    :duration="4000"
    :decimals="2"
    separator=","
    prefix="$"
    suffix="元"
  />
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { LCountTo } from '@vue3-simple-bui/screen';

export default defineComponent({
  name: 'Demo',
  components: {
    LCountTo,
  },
});
</script>

基于 MIT 许可发布