代码之家  ›  专栏  ›  技术社区  ›  Slim

在React组件中上载图像后无法显示图像

  •  0
  • Slim  · 技术社区  · 7 年前

    我想上传多个图像,然后在浏览器中显示它们。我写了这段代码 link 我用图像的名称来代替图像:

    Image1.png
    Image2.png 
    

    如果有人知道另一个NPM模块上传和显示图片作为画廊,我该如何修复这个问题?如果有人向我提及它,我将不胜感激。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Cameron Downer    7 年前

    withPreview <ImageUploader />

    const UploadImage = props => {
      const { onDrop } = props;
      return (
        <ImageUploader
          withIcon
          buttonText="Upload Image"
          onChange={onDrop}
          imgExtension={[".jpg", ".gif", ".png", ".gif"]}
          maxFileSize={5242880}
          withPreview
        />
      );
    };
    

    here

    See the documentation for the library for more details.