项目场景:
表单使用下拉项
问题描述
Uncaught TypeError: Cannot read properties of undefined (reading ‘toString’)
代码使用
<ComboBox{...props}textField="name"dataItemKey="sysId"style={{ borderColor: valid ? "#ced4da" : "red", ...props.style }}//sourceData 是数组对象data={ sourceData }filterable={true}onFilterChange={filterChange}/>
原因分析:
报错原因是,因为传入的sourceData里对象里的字段中 和textField字段没有对应上,
解决方案:
textField 要选择sourceData里对象里的字段就可以了