1.4.2 • Published 5 years ago
m-zhinanmao-component-count-timer v1.4.2
m-zhinanmao-component-count-timer
指南猫计数定时器组件
使用
// count-timer.ts
import CountTimer from 'm-zhinanmao-component-count-timer/lib/count-timer';
const countTimer = new CountTimer(CountTimer.TYPE.REMAIN);
const callback = () => {};
countTimer
.setOrigin(Date.now())
.setUnitArr(['秒', '分', '时', '天'])
.setCallback(callback)
.start();
countTimer.stop();
// WithCountTimer.tsx
import WithCountTimer from 'm-zhinanmao-component-count-timer';
<WithCountTimer origin={origin} type={WithCountTimer.TYPE.REMAIN}>
{timeArr => (
<div>{timeArr.map(n => n.value + n.unit).join('')}</div>
)}
</WithCountTimer>
开始
yarn
yarn start
yarn compile
开发
查看 rc-tools