我在单击上一步时使用多个步骤表格,而选择值不存在,selectInput为空白。
这是我正在使用的代码:
<SelectInput value={this.state.value}
onChange={this.handleDropDownChange}
errorText={err.State}
maxHeight={200}
name="State"
floatingLabelText={messages.STATE[lang]}
floatingLabelFixed={true}
>
{
this.props.ci.StatesOfUS.map((element) => {
return <MenuItem value={element.Value} primaryText={element.Value} />
})
}
</SelectInput>
也许是因为当您进入上一个步骤并且所有状态丢失时,您的组件已卸下。在这种情况下,您可以将状态拉到父组件。请参阅https://reactjs.org/docs/lifting-state-up.html。