vue-countup-v2 设置开始时间无效
可能是因为您没有正确设置开始时间。请确保您按照以下步骤操作:
-
在组件中添加
ref属性,例如:<vue-countup-v2 ref="countup"></vue-countup-v2> -
在 Vue 实例中添加
mounted钩子,例如:
mounted() {
this.$refs.countup.start()
}
- 在
start()方法中设置开始时间,例如:
start() {
const now = new Date()
const start = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)
this.$refs.countup.startAt = start
}
请注意,您可以根据需要设置不同的开始时间。此外,请确保您的计数器已经正确地初始化,并且可以按预期工作。
原文地址: https://www.cveoy.top/t/topic/4km 著作权归作者所有。请勿转载和采集!