ant 踩坑。 之 Cannot use 'in' operator to search for 'value' in undefined at getValuePropValue (util.js:29)
再使用多選 Select 組件時候報錯 如圖
原因是因為在 options 未渲染之前給 value 賦值了。
let children =
List.length && List.map((item) => {
return <Option name={item.userName} key={item.userId} value={item.userId} >{item.userName}</Option>
})
<Select
{..Props}
value={value}
multiple
style={{ width: '376px', marginRight: '10px' }}
onChange={this.handleChange}
optionFilterProp="children"
labelInValue
>
{children}
</Select>
將 紅色部分刪除掉 :
1 let children = shapeExpertsList.map((item) => { 2 return <Option name={item.userName} key={item.userId} value={item.userId} >{item.userName}</Option> 3 }