diff --git a/src/views/basicdata/brand/basicBrand.vue b/src/views/basicdata/brand/basicBrand.vue index 14445d8f..46d47041 100644 --- a/src/views/basicdata/brand/basicBrand.vue +++ b/src/views/basicdata/brand/basicBrand.vue @@ -390,16 +390,18 @@ export default { this.form.brandIcon = res.data.link; }, beforeAvatarUpload(file) { - const isJPG = file.type === 'image/jpeg'; + const isJPEG = file.type === 'image/jpeg'; + const isJPG = file.type === 'image/jpg'; + const isPNG = file.type === 'image/png'; const isLt2M = file.size / 1024 / 1024 < 2; - if (!isJPG) { - this.$message.error('上传头像图片只能是 JPG 格式!'); + if (!isJPEG && !isJPG && !isPNG) { + this.$message.error('上传头像图片是 JPG | JPEG | PNG 格式!'); } if (!isLt2M) { this.$message.error('上传头像图片大小不能超过 2MB!'); } - return isJPG && isLt2M; + return (isJPG || isJPEG || isPNG) && isLt2M; }, uploadSuccess(fileList) { console.log('123123123', fileList);