【发布时间】:2022-09-29 21:05:32
【问题描述】:
我有一个迭代代码。我正在使用 react 和 antd select。
{this.state.count.map((d, i) => (
<Select
placeholder={`Question #${i + 1}`}
style={{ width: \'100%\' }}
onChange={(e) => this.setState({securityQuestions{i}:e})} // here I have issue.. need to set name with index
showSearch
optionFilterProp=\"children\"
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
filterSort={(optionA, optionB) =>
optionA.children.toLowerCase().localeCompare(optionB.children.toLowerCase())
}>
{this.state.securityQuestions && this.state.securityQuestions.map((d) => <Select.Option value={d.id}>{d.securityQuestion}</Select.Option>)}
</Select>
))}
我的代码是这样的。正如我在代码中提到的,我在“onchange”中有问题。我想设置名称及其索引。谁能帮我?
标签: reactjs