📜  10 秒后将状态设置为 false 反应本机 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:24.191000             🧑  作者: Mango

代码示例1
saveAndContinue: function(e) {
    e.preventDefault()

    if(this.state.submitted==false) {
        email = this.refs.email.getDOMNode().value
        this.setState({email: email})
        this.setState({submitted: !this.state.submitted});
        setTimeout(function(){
             this.setState({submitted:false});
        }.bind(this),10000);  // wait 5 seconds, then reset to false
   }
}