官网:http://inorganik.github.io/countUp.js/
github:https://github.com/glennreyes/react-countup
原生js自己写的话:https://www.jb51.net/article/194100.htm
代码:
import CountUp from 'react-countup';
const Index: React.FC = () => {
return (
<CountUp
start={0}
enableScrollSpy
end={item.count}
duration={0.5}
separator=','
redraw={true}>
</CountUp>
)
}
export default Index;
效果:
屏幕录制2022-08-12 下午6.08.06