Commit 83f4732b by liangzhen

限制大小

1 parent a4101706
......@@ -88,6 +88,10 @@ axios.interceptors.response.use(response => {
return response;
}
}, err => {
if (loadingInstance) {
loadingInstance.close();
Message.error('上传失败')
}
if (err && err.response) {
console.log('连接到服务器失败');
} else {
......
......@@ -245,6 +245,7 @@
return fileupdate(scope.row, res);
}
"
:before-upload="beforeUpload"
:on-change="uploadChange"
:with-credentials="true"
:auto-upload="true"
......@@ -512,6 +513,14 @@ export default {
},
methods: {
beforeUpload(file) {
console.log( file.size / 1024 / 1024,'多大')
const isLt500M = file.size / 1024 / 1024 < 500;
if (!isLt500M) {
this.$message.error('上传的文件不能超过500MB!');
}
return isLt500M;
},
numberVal(val) {
this.$forceUpdate();
},
......@@ -767,7 +776,6 @@ export default {
// 移除附件
// 监控上传文件列表
uploadChange(file, fileList) {
// console.log(fileList, "this.fileList");
// let existFile = fileList
// .slice(0, fileList.length - 1)
// .find((f) => f.name === file.name);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!