mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-11 13:02:49 +00:00
优化
This commit is contained in:
parent
94d9e7d716
commit
c2a7f09e9e
@ -334,6 +334,12 @@ async function onBeforeUpload(file: any, item?: Upload.Item) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 文件大小限制
|
||||
if (file.size / 1024 / 1024 >= limitSize) {
|
||||
ElMessage.error(t('上传文件大小不能超过 {n}MB!', { n: limitSize }));
|
||||
return false;
|
||||
}
|
||||
|
||||
// 自定义上传事件
|
||||
if (props.beforeUpload) {
|
||||
let r = props.beforeUpload(file, item, { next });
|
||||
@ -348,11 +354,6 @@ async function onBeforeUpload(file: any, item?: Upload.Item) {
|
||||
|
||||
return r;
|
||||
} else {
|
||||
if (file.size / 1024 / 1024 >= limitSize) {
|
||||
ElMessage.error(t('上传文件大小不能超过 {n}MB!', { n: limitSize }));
|
||||
return false;
|
||||
}
|
||||
|
||||
return next();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user