import { axios } from '@/utils/request'
/*
* file:文件对象
*/
function upFile (file) {
const fileList = [ file]
const formData = new FormData()
fileList.foreach(file => {
formData.append('file',file )
})
axios({
url:url,
method: 'post',
data: formData,
processData: false,// 告诉axios不要去处理发送的数据(重要参数)
contentType: false, // 告诉axios不要去设置Content-Type请求头
}).then(res => {
console.log(res)
}).catch(() => {
console.log('error')
})
}