我正在使用带有 material-ui 的自动完成组件。
搜索字段中“customerList”中的数据没有问题。但是我无法获得我选择的数据的“ID”号。我想获取所选数据的 ID 号。
此外,会出现如下错误。我怎样才能解决这个问题?
import Autocomplete from '@material-ui/lab/Autocomplete';
class AppointmentFormContainerBasic extends React.PureComponent {
constructor(props) {
super(props);
}
render() {
const textEditorProps = (field) => ({
variant: 'outlined',
onChange: ({ target: change }) => this.changeAppointment({
field: [field], changes: change.value
}),
value: displayAppointmentData[field] || '',
className: classes.textField
});
const customerList = [
{id: "1", customerName: 'John', customerSurname: "test0"},
{id: "2", customerName: 'Bob', customerSurname: "test1"},
{id: "3", customerNametle: 'steve', customerSurname: "test2"},
{id: "4", customerName: 'steve', customerSurname: "test3"},
{id: "4", …Run Code Online (Sandbox Code Playgroud)