let fd = new FormData();
//传文件
fd.append("file", this.fileObj);
//传图片
fd.append("file", this.getImg.raw);
let config = {
headers: {
"Content-Type": "multipart/form-data",
},
};
this.$axios
.post(
url
fd,
config
)
.then(function (response) {
if (response.data.msg == "成功") {
// 成功
vm.$message({
duration: 700,
message: "上传成功",
type: "success",
})
} else {
vm.$message({
duration: 700,
message: response.data.msg,
type: "warning",
});
}
})
.catch(function (error) {
vm.$message({
duration: 700,
message: "保存失败",
type: "error"
});
});
},
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交