把工程里无关代码去掉,剩下下面这段代码。按下键盘的时候,componentWillUpdate函数执行了,但blur()函数没有产生效果,这个是为什么?
注:有很多办法可以练过这个问题,比如componentDidUpdate,比如setTimeout(,0),但为什么写在componentWillUpdate里不可以。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
class HelpBox extends React.Component {
}
用这个componentDidUpdate,监听keyup,输入完成失去焦点