【发布时间】:2016-10-08 06:33:18
【问题描述】:
我如何在酶中测试input.focus()。我正在编写带有反应的脚本。我的代码如下:
public inputBox: any;
componentDidUpdate = () => {
setTimeout(() => {
this.inputBox.focus();
}, 200);
}
render() {
return (
<div>
<input
type = 'number'
ref = {element => this.inputBox = element } />
</div>
);
}
【问题讨论】:
标签: reactjs typescript enzyme onfocus