5
3秒演示https://www.youtube.com/watch?v=bo2nNQXbhI8&feature=youtu.be所選擇的選項將被恢復到未選擇的狀態
https://gist.github.com/weichenghsu/407a8862f3382a425fb531b3dedcd6f5
作爲標題,所選擇的選項將被恢復到未選擇的狀態
而且onChange
方法具有用於無影響官方教程示例。
我的用例是,當用戶從下拉列表中選擇一個值。它應該解僱的行動來獲取其他數據並呈現另一種形式的
const chooseTable = ({items, meta:{touched, error}}) => (
<select
onChange={event => {
console.log(this.props.fields);
this.props.tableNameOnChange(event.target.value);
}}>
<option value="">Select</option>
{
items.map((item :any, i: integer) =>
<option key={item.id} value={item.id}>{item.name}</option>
)
}
</select>
)
<Field component={chooseTable}
items={schemaData.tableList}
name="tableName"
>
{/*<option value="#ff0000">Red</option>*/}
{/*<option value="#00ff00">Green</option>*/}
{/*<option value="#0000ff">Blue</option>*/}
</Field>
UIBuilderForm = reduxForm({
form: 'dashbaordUiBuilderForm',
fields: ['tableName']
}
})
(UIBuilderForm as any);
// Decorate with connect to read form values
const selector = formValueSelector('dashbaordUiBuilderForm')
// export default connect(mapStateToProps, mapDispatchToProps)(UIBuilderForm);
export default connect(state => {
const TableSchemaName = selector(state, 'TableSchemaName')
return {
TableSchemaName
}
}
Redux表格''要求您使用各種道具[如此處所述](http://redux-form.com/6.4.3/docs/api/Field.md/)。 –
gustavohenke
沒有用,調度動作仍然不起作用onChange方法 – newBike