你能否告诉我如何将输入日期字段集中在做出反应?我正在使用语义插件https://www.npmjs.com/package/semantic-ui-calendar-react
我想关注按钮点击日期输入字段这里是我的代码。这是我的代码https://codesandbox.io/s/3l414mno5
focus = () => {
console.log(this.a);
this.a[0].onFocus();
// this.inputRef.focus()
};
重点不在输入领域为什么?任何更新 ?
要关注按钮单击,您需要设置如下所示的ref:
this.logButton = React.createRef();
ref={this.logButton}
并按下按钮点击它,如下所示:
focus = e => {
this.logButton.current.openPopup();
};
qazxsw poi - 是一个打开日历弹出窗口的函数,你使用的插件,有这样的代码,检查qazxsw poi
openPopup()
和在多个数据字段中,使用动态引用。希望能帮助到你。