如何在 Semantic-UI-React 中将下拉列表恢复为默认值
How to restore dropdown to default value in Semantic-UI-React
默认semantic-ui
我们可以做这个选项:https://github.com/Semantic-Org/Semantic-UI/commit/b4ae26d24f75886c3d5f6fc4f00e176f09705a13
但是,如何在 semantic-ui-react
中做到这一点? Google 没什么好说的,拜托,我需要帮助。
我想要达到的目标:
我正在使用 redux-form
。在我的表单中呈现语义组件 <Form.Select multiple ....>
并在成功提交后 - 调用 redux-form
方法 reset
。一切都很好,表格很清楚...但不是 dropdown/select 字段。有什么想法吗?
我解决问题如下:
Semantic-ui-react
props value
设置字段的当前值。
<Form.Select
name={input.name}
options={options}
label={label}
placeholder={placeholder}
search
multiple
selectOnBlur={selectOnBlur}
onFocus={::this.handleFocus}
onBlur={::this.handleBlur}
onChange={::this.handleChange}
defaultValue={defaultValue || []}
value={input.value}
loading={loading} />
默认semantic-ui
我们可以做这个选项:https://github.com/Semantic-Org/Semantic-UI/commit/b4ae26d24f75886c3d5f6fc4f00e176f09705a13
但是,如何在 semantic-ui-react
中做到这一点? Google 没什么好说的,拜托,我需要帮助。
我想要达到的目标:
我正在使用 redux-form
。在我的表单中呈现语义组件 <Form.Select multiple ....>
并在成功提交后 - 调用 redux-form
方法 reset
。一切都很好,表格很清楚...但不是 dropdown/select 字段。有什么想法吗?
我解决问题如下:
Semantic-ui-react
props value
设置字段的当前值。
<Form.Select
name={input.name}
options={options}
label={label}
placeholder={placeholder}
search
multiple
selectOnBlur={selectOnBlur}
onFocus={::this.handleFocus}
onBlur={::this.handleBlur}
onChange={::this.handleChange}
defaultValue={defaultValue || []}
value={input.value}
loading={loading} />