PUT请求,评估图像:存储在变量中

如何使用Vue / Javascript将路径中的图像存储在变量中,以便它们也可以显示在图像库中?现在,我的图像画廊仅接受来自表单的文件(而不是路径)。由于存在PUT请求,因此需要此行为。

服务器提供带有{'uploads / imgXyx'}之类图像的动态路径。

这是fileList的console.log。

//console.log fileList created with the form.
(3) [File,File,File]
0: File {name: "IMG_3622.JPG",lastModified: 1527016548000,lastModifiedDate: Tue May 22 2018 21:15:48 GMT+0200 (Midden-Europese zomertijd),webkitRelativePath: "",size: 29579,…}

Vue方法接受文件而不是路径,并将其显示在图像库中。

methods: {
handleSelects (e) {
  let fileList = Array.prototype.slice.call(e.target.files)
  if (fileList...{
  //evaluation of images,type images,amount etc
  }
      this.images = []
      let fileReader = new FileReader()
      let that = this
      fileReader.onload = function (e) {
        that.images.push(e.target.result)
      }
      fileReader.readAsDataURL(f)
    //display images
    })
}
zhangzhiwei1986913 回答:PUT请求,评估图像:存储在变量中

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2850952.html

大家都在问