async httpRequest(param) {
let formData = new FormData()
formData.append('file', param.file)
const config = {
onUploadProgress: progressEvent => {
this.progress = Number(
((progressEvent.loaded / progressEvent.total) * 100).toFixed()
)
}
}
const { viewPath } = await FileUpload(formData, config)
this.$message.success('脚本文件上传成功')
this.form.kettlePath = viewPath
},
import request from '@/plugin/axios'
const BASE_URL = 'sys/file'
export function FileUpload(data, config) {
return request({
url: BASE_URL + '/upload',
method: 'post',
data,
headers: { 'Content-Type': 'multipart/form-data' },
...config
})
}
网友评论