请考虑以下情形:我要显示的列表包含一些数据和图片文件。用户可以通过输入数据并使用输入选择图片来创建列表项。但是当我要编辑该列表时,服务器将发送图片文件,但希望返回文件(或Blob)来编辑列表,我无法提供该列表,因为如果用户不选择编辑图片,则没有输入标签。我应该如何将网址中的文件对象发送到服务器显示一些代码,这是对服务器的axios调用:
var form = new FormData();
let items=this.itemsToSend;
let pics=this.itemPics;
form.append("items",items);
form.appen("pics",pics)
let response = await axiosCall("/listItems", 'patch', form)
对于图片中的每个图片,请尝试使用:]
axios({
method: 'get',
url: pic.url,
responseType: 'blob'
}).then((res) => res.data // res data should be a blob)