Reactjs can';t在redux中上载图像文件form@7.0.4
我正在尝试使用redux表单上载动态多图像文件。因为Reactjs can';t在redux中上载图像文件form@7.0.4,reactjs,ecmascript-6,redux,redux-form,Reactjs,Ecmascript 6,Redux,Redux Form,我正在尝试使用redux表单上载动态多图像文件。因为不支持设置值。我已定义了名为FileInput const FileInput = ({ input:{value: omitValue,...inputProps}, label, type, meta: { touched, error, warning } }) => ( <div> <input type={type} {...inputProps} cla
不支持设置值。我已定义了名为FileInput
const FileInput = ({ input:{value: omitValue,...inputProps}, label, type,
meta: { touched, error, warning } }) => (
<div>
<input
type={type} {...inputProps} className='form-control'
/>
{touched && error && <span className="text-danger">{error}</span>}
</div>)
constfileinput=({input:{value:omitValue,…inputProps},标签,类型,
meta:{触摸,错误,警告}})=>(
{触摸&&error&&{error}
)
form.js
const Form = props => {
const { handleSubmit, pristine, reset, submitting} = props
return (
<form onSubmit={handleSubmit(handleProductInfo)} encType='multipart/form-data'>
<div className="form-group ">
<label>Thumbnail Image</label>
<Field name="thumbnailImage"
component={FileInput}
type="file"
/>
</div>
</form>
const Form=props=>{
const{handleSubmit,pristite,reset,submiting}=props
返回(
缩略图
生成上载字段输入标记的步骤
const renderImageFeatures = ({ fields, meta: { error, submitFailed } }) => (
<div>
<button type="button" className="btn btn-success" onClick={() => fields.push({})}>
<i className="fa fa-plus-circle" aria-hidden="true"></i> Add Images
</button>
{submitFailed && error && <div className="text-danger">{error}</div>}
<ul className="featuresList">
{fields.map((imagefeatures, index) => (
<li key={index} className="col-md-2 my-2">
<button
type="button"
title="Remove Image"
className="btn btn-danger pull-right"
onClick={() => fields.remove(index)}
><i className="fa fa-trash" aria-hidden="true"></i>
</button>
<h5>Image #{index + 1}</h5>
<div className="form-group">
<Field name={`${imagefeatures}.image`}
component={FileInput}
type="file"
/>
</div>
</li>
))}
</ul>
</div>
)
const renderImageFeatures=({fields,meta:{error,submitFailed}})=>(
fields.push({}}>
添加图像
{submitFailed&&error&&{error}
{fields.map((图像特征,索引)=>(
-
字段。删除(索引)}
>
图像#{index+1}
))}
)
在开发人员工具中,将显示上载的文件信息
但在网络选项卡标题中,它显示为