【发布时间】:2019-03-11 21:31:25
【问题描述】:
在尝试将项目悬停在下拉建议菜单中时,我正在尝试将该项目设置为 activeElement 和 activeIndex。但是键盘up/down 箭头停止使用此更改。我希望 up/down 箭头键也可以从 activeIndex 中工作。怎么做?这是我的代码
public itemFocus = (e: any) => {
let ce = e.currentTarget.id.toString();
ce = ce.substring(ce.length - 1);
this._typeahead.getInstance().setState({
activeIndex: ce,
activeItem: this.state.options[ce]});
}
idx 表示结果的迭代器索引
<MenuItem onMouseOver={this.itemFocus} key={idx} option={state} position={idx}>
【问题讨论】:
标签: reactjs react-bootstrap-typeahead