const isLt20M = file.size / 1024 / 1024 < 20; //单个大小
if (!isLt20M) {
fileList.splice(fileList.indexOf(file), 1);
message.info(‘单个文件上传大小不能超过20M’);
return false
}
const fileSuffix = file.name.substring(file.name.lastIndexOf(“.”) + 1); //截取后缀
const whiteList = ["doc", "docx", "xls", "pdf", "zip", 'xlsx'];
if (whiteList.indexOf(fileSuffix) === -1) {
message.error('上传文件只能是 .doc, .docx, .xls, .pdf, .zip格式');
return false
}