优化上传成功方法处理
This commit is contained in:
parent
77aec2ed3d
commit
1e1e494d5b
@ -144,10 +144,12 @@ export default {
|
|||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file) {
|
||||||
|
if (res.code != 200) {
|
||||||
|
this.msgError(`上传失败,原因:${res.msg}!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.msgSuccess("上传成功");
|
this.msgSuccess("上传成功");
|
||||||
console.log(res.data.fileName, res.data.url);
|
|
||||||
this.fileList.push({ name: res.data.fileName, url: res.data.url });
|
this.fileList.push({ name: res.data.fileName, url: res.data.url });
|
||||||
|
|
||||||
this.$emit("input", this.column, this.listToString(this.fileList));
|
this.$emit("input", this.column, this.listToString(this.fileList));
|
||||||
},
|
},
|
||||||
// 删除文件
|
// 删除文件
|
||||||
|
|||||||
@ -111,9 +111,14 @@ export default {
|
|||||||
},
|
},
|
||||||
//上传成功回调
|
//上传成功回调
|
||||||
handleUploadSuccess(res) {
|
handleUploadSuccess(res) {
|
||||||
|
console.log(res);
|
||||||
|
this.loading.close();
|
||||||
|
if (res.code != 200) {
|
||||||
|
this.msgError(`上传失败,原因:${res.msg}!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.fileList.push({ name: res.data.fileName, url: res.data.url });
|
this.fileList.push({ name: res.data.fileName, url: res.data.url });
|
||||||
this.$emit(`input`, this.column, this.listToString(this.fileList));
|
this.$emit(`input`, this.column, this.listToString(this.fileList));
|
||||||
this.loading.close();
|
|
||||||
},
|
},
|
||||||
// 上传前loading加载
|
// 上传前loading加载
|
||||||
handleBeforeUpload(file) {
|
handleBeforeUpload(file) {
|
||||||
@ -167,7 +172,7 @@ export default {
|
|||||||
for (let i in list) {
|
for (let i in list) {
|
||||||
strs += list[i].url.replace(this.baseUrl, "") + separator;
|
strs += list[i].url.replace(this.baseUrl, "") + separator;
|
||||||
}
|
}
|
||||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
return strs != "" ? strs.substr(0, strs.length - 1) : "";
|
||||||
},
|
},
|
||||||
handleUploadError() {
|
handleUploadError() {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user