import React,{Component} from 'react';
import { Switch,message } from 'antd';
export default class AgcMapedit extends Component{
state = {
Switch_1:'NO',
}
timer = null
iTimer = ()=>{
this.timer = setInterval(async ()=>{
message.success("执行一次")
},1000)
}
onClick_1 = ()=>{
// const t = setInterval(run, 1000)
if(this.state.Switch_1==='NO'){
this.setState({Switch_1:'OFF'})
this.iTimer()
}else {
this.setState({Switch_1:'NO'})
clearInterval(this.timer)
}
}
render(){
return(
<div>
<Switch defaultChecked={false} onChange={this.onClick_1}/>
</div>
)
}
}