let formObj = new FormData() //formdata
formObj.append('images[]', params.imgArr[0])
// console.log(images[] )
axios.post(url, formObj , {
timeout: 10000000,
headers:{'Content-Type':"application/x-www-form-urlencoded",token:params.token},//设置header
withCredentials:true,//携带cookie
onUploadProgress: progressEvent => {
},
}).then(response => {
console.log(response.data.errcode)
if (response.data.errcode === 0) {
console.log(response.data)
resolve(response.data);
// Vue.prototype.$toast('上传成功')
} else {
Toast(response.data.msg)
}
}).catch(err => {
// Indicator.close();
reject(err);
})
网友评论