为了方便,简单的记录一下:
在state中设置一个控制点击事件
this.state = {
isClick: true
}
在点击事件的函数里
handleOk = () => {
const { isClick } = this.state
if (isClick) { //如果为true 开始执行
this.setState({ isClick: false }) //将isClick 变成false,将不会执行处理事件
// 编写点击事件执行的代码
const that = this // 为定时器中的setState绑定this
setTimeout(function () { // 设置延迟事件,1秒后将执行
that.setState({ isClick: true }) // 将isClick设置为true
}, 1000);
}
};
-------------------------------------------------------------------------------------------------------------------------------------------------------------------如遇到问题:+WX:WAZJ-0508,及时联系---------------------------------------------------------------------------------------------------------------------------------------------------