在使用vant组件vant-upload上传图片的时候,代码如下:
//html//jsonRead(file, detail) { let self = this; let data = new FormData(); if (file instanceof Array) { file.forEach((item, index) => { window.console.log('index', index); self.data.append(`file${index}`, item.file); }) } else { self.data.append(`file`, file.file) } window.console.log('file:', file, 'detail:', detail); /*this.upload(data) .then((res) => { window.console.log('res:', res); }) .catch(reason => { window.console.log(reason); })*/ }
后端正常接收