<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 自定义上传文件
猜你喜欢
转载自blog.csdn.net/weixin_41991501/article/details/81429353
今日推荐
周排行