- 安装lucky-wheel包
npm install -S lucky-wheel
- render组件
import LuckyWheel from 'lucky-wheel';
constructor(props) {
super(props);
this.state = {
position: 0,
isComplete: false
}
}
handleLoadData = () => {
setTimeout(() => {
this.setState({
position: 2,
isComplete: true
})
}, 1000);
}
handleComplete = () => {
this.setState({isComplete: false})
}
render() {
return (
<LuckyWheel
onLoadData={this.handleLoadData}
position={this.state.position}
areaNum={7}
cycle={10}
isComplete={this.state.isComplete}
onComplete={this.handleComplete}
TURNTABLE_BG={TURNTABLE_BG} // new added
TURNTABLE={TURNTABLE}// new added
POINTER={POINTER}// new added
/>
)
}
If you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it: