<el-upload
ref="upload"
action=""
:http-request="uploadFile"
>
<el-button type="primary" size="small">上传</el-button>
</el-upload>
export default {
data() {
return { }
},
methods: {
uploadFile(param) {
const formData = new FormData()
formData.append('file', param.file)
const data = {} // 上传要携带的参数
formData.append('data', data)
obsUpload(formData).then(res => {
console.log(res)
})
}
}
}
网友评论