上传头像优化

This commit is contained in:
禺狨 2023-04-07 17:00:20 +08:00
parent 7af9f1e761
commit b6bee05379

View File

@ -51,7 +51,11 @@ export const UserInfoModel: React.FC<PropInterface> = ({ open, onCancel }) => {
if (!isPNG) {
message.error(`${file.name}不是图片文件`);
}
return isPNG || Upload.LIST_IGNORE;
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error("超过2M限制不允许上传");
}
return (isPNG && isLt2M) || Upload.LIST_IGNORE;
},
onChange(info: any) {
const { status, response } = info.file;