我想知道我在这里做错了。
const options = {
headers: {
'Content-Type': 'multipart/form-data'
},
onUploadProgress: (progressEvent) => {
console.log(progressEvent)
var percentCompleted = Math.floor((progressEvent.loaded * 100) / progressEvent.total);
console.log(percentCompleted)
}
}
axios.post(this.$data_static.api, formData, options)
.then(function({data}) {
console.log(data)
}).catch(err => {
console.log(err)
})
并且console.log()
中的返回值为0,我的axios
请求返回catch()
谢谢!