Compare commits
2 Commits
129cdcfd0c
...
e6c1599cb2
| Author | SHA1 | Date | |
|---|---|---|---|
| e6c1599cb2 | |||
| ab50ef7786 |
@ -83,13 +83,13 @@
|
|||||||
/**
|
/**
|
||||||
* 上传文件之前验证
|
* 上传文件之前验证
|
||||||
*/
|
*/
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (rawFile) => {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 200;
|
const isLt2M = rawFile.file.file.size / 1024 / 1024 < 200;
|
||||||
if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
message.warning('大小不能超过200MB!');
|
message.warning('大小不能超过200MB!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
|
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(rawFile.file.name)) {
|
||||||
message.warning('请上传.xlsx .xls');
|
message.warning('请上传.xlsx .xls');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,13 +84,13 @@
|
|||||||
/**
|
/**
|
||||||
* 上传文件之前验证
|
* 上传文件之前验证
|
||||||
*/
|
*/
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (rawFile) => {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 200;
|
const isLt2M = rawFile.file.file.size / 1024 / 1024 < 200;
|
||||||
if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
message.warning('大小不能超过200MB!');
|
message.warning('大小不能超过200MB!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) {
|
if (!/\.(xlsx|xls|XLSX|XLS)$/.test(rawFile.file.name)) {
|
||||||
message.warning('请上传.xlsx .xls');
|
message.warning('请上传.xlsx .xls');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user