springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-18 12:46:57
225
这是我的选择组元素。
<ChoiceGroup defaultSelectedKey="No"
options={[{ key: 'Yes', text: 'Yes' },{ key: 'No', text: 'No' }]}
onChange={this._onChange}
id={'ChoiceGroup1'}
name={this.state.currentUser} />
和我的onchange函数
public _onChange=(ev, option: IChoiceGroupOption)=> {
console.log(ev,option); }
但我无法获取target.id值。目标显示为空,但在TextField的情况下,我能够获得组件
的名称和目标顺晟科技:
您可以手动将所选项目的ID传递给_onChange函数。
根据道具和用例,我假设您的ChoiceGroup组件通过“选项”进行映射。道具并渲染另一个组件。如果是这样的话,您可以稍微调整一下,让它将单击的项传递给父组件(这样您就可以决定如何处理它)。
因此,在ChoiceGroup组件中添加
{options.map(option =>
<ChoiceGroupOption
onClick={e => onItemSelected(option)}
/>}
<ChoiceGroup defaultSelectedKey="No"
options={[{ key: 'Yes', text: 'Yes' },{ key: 'No', text: 'No' }]}
onItemSelected={item => this._onChange(e, item.id)}
id={'ChoiceGroup1'}
name={this.state.currentUser} />
然后在事件处理程序中输入:
public _onChange = (ev, selectedId)=> {
console.log('ID: ', selectedId);
}
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11