var formdata = new FormData()
formdata.append("file", 'fileData')
this.axios({
url:'/api/books/post/',
method:'post',
data:formdata, //我们传formdata会占用整个传参对象
headers:{"Content-Type": "multipart/form-data"}
}).then(res=>{
console.log(res)
})
this.axios({
url:'/api/books/get/',
method:'get',
}).then(res=>{
console.log(res)
})
Vue跨域请求post\get
于 2021-10-10 16:55:21 首次发布