beforeAvatarUpload(file) {
this.loading = true
const isJPG = file.type === 'image/jpeg';
const isPNG = file.type === 'image/png';
const isLt10M = file.size / 1024 / 1024 < 10;
if (!isJPG && !isPNG) {
this.$message.error('上传图片只能是 JPG 或者 PNG 格式!');
}
if (!isLt10M) {
this.$message.error('上传图片大小不能超过 10MB!');
}
return (isJPG || isPNG) && isLt10M;
},
element-ui 上传图片限制格式
猜你喜欢
转载自blog.csdn.net/Hero_rong/article/details/105785483
今日推荐
周排行