beforeUpload(
file) {
//图片上传之前校验
const
isPNG =
file.
type ===
'image/png';
const
isLt200k =
file.
size/
1024 <
200;
if (!
isPNG) {
this.
$message.
error(
'上传图片只能是 PNG 格式!');
}
if (!
isLt200k) {
this.
$message.
error(
'上传图片大小不能超过 200kb!');
}
return
isPNG &&
isLt200k;
},