Commit 6c0178da authored by GuanHua's avatar GuanHua
parents 798857bd 7a07d622
......@@ -54,17 +54,19 @@ const ImgUpload = forwardRef((props: IProps, ref: any) => {
useImperativeHandle(ref, () => ({
setData(imgs: string[]) {
const newFileList = imgs.map((item, index) => {
return {
uid: `uid${index}`,
name: 'image.png',
status: 'done',
url: item,
}
})
// 直接走一次回调,使值可以set进表单
handleChange({ file: { status: 'success' }, fileList: newFileList})
// setFileList(newFileList)
if (imgs) {
const newFileList = imgs.map((item, index) => {
return {
uid: `uid${index}`,
name: 'image.png',
status: 'done',
url: item,
}
})
// 直接走一次回调,使值可以set进表单
handleChange({ file: { status: 'success' }, fileList: newFileList})
// setFileList(newFileList)
}
},
}))
......@@ -137,7 +139,7 @@ const ImgUpload = forwardRef((props: IProps, ref: any) => {
{fileList.length >= maxCount || disabled ? null : uploadButtonElement}
</Upload>
{
tips &&
tips &&
<div className={styles.tips}>
<div>支持 {fileType.map(item => item.split('/')[1]).join('/')}</div>
<div>最大不超过 {maxSize} {unit}</div>
......
......@@ -156,8 +156,8 @@ const OwnMallAboutUs = () => {
const { albumName, albumUrl, honorPics, workshopPics, ...rest } = data
const newAlbumUrls = albumName && albumUrl ? [{ name: albumName, url: albumUrl }] : []
workshopImgRef.current?.setData(workshopPics)
honorImgRef.current?.setData(honorPics)
workshopPics && workshopImgRef.current?.setData(workshopPics)
honorPics && honorImgRef.current?.setData(honorPics)
form.setFieldsValue({
...rest,
albumUrls: newAlbumUrls
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment