预览antd中上传的图片

时间:2018-12-03 12:41:56

标签: reactjs antd

我已在我的应用程序中实现了一个PicturesWall组件,类似于antd网站https://ant.design/components/upload/#components-upload-demo-picture-card上的该组件。用户上载图像时,将生成缩略图,并且用户可以预览和删除它们。现在,这是我创建项目的时间,但是我实现了编辑功能,在该功能中,我使用用户创建项目时输入的内容填充了输入文本字段。我如何列出用户创建项目时上传的图像?

1 个答案:

答案 0 :(得分:0)

While editing, you need to update the state of fileList and previewImage similar to the initial state as given below:

this.setState({
    fileList:[{uid:-1,status: 'done',url:'your image Url'}],
    previewImage: 'your image Url',
});

You can do this by checking if you are getting the image data to be edited.

相关问题