我有一个多选字段和一个单独的角色创建表单。当我创建新角色并从多选下拉列表中选择一个角色时,它将选择所有新创建的角色并将空值发送给该函数。
我只选择我选择的一个选项。
<MultipleSelect
value={this.selected}
options={this.considerationEntityOptions}
onChange={this.handleSelectEntity}
label={`Select ${this.approvalType}`}
disabled={this.considerationEntityOptions.length === 0}
/>
@action handleSelectEntity = (value: string[]) => {
// here it recieves the empty array
debugger;
console.log(value);
this.selected.replace(value);
}
我希望我选择的选项的值。