<el-upload
action=""
:on-change="handleChange"
:http=request="uploadFile">
</el-upload>
data() {
return {
// 上传的文件
file: {}
}
}
methods:{
// 上传文件,获取文件流
handleChange(file) {
this.file = file.raw
}
// 自定义上传
uploadFile() {
// 创建表单对象
let form = new FormData();
// 后端接受参数 ,可以接受多个参数
form.append("file",this.file)
form.append(" "," ")
this.$axios({
data:from ,
url: "后端接口地址",
method: "method"
})
}
}
最后
以上就是落后小甜瓜最近收集整理的关于element-ui 自定义上传文件的全部内容,更多相关element-ui内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复