任何人都可以帮我测试酶中的input.focus().我正在用react.My代码编写脚本.
public inputBox: any;
componentDidUpdate = () => {
setTimeout(() => {
this.inputBox.focus();
}, 200);
}
render() {
return (
<div>
<input
type = 'number'
ref = {element => this.inputBox = element } />
</div>
);
}
Run Code Online (Sandbox Code Playgroud)