From 002051f8932f15efc86184b4ca8c5fe01bbc9856 Mon Sep 17 00:00:00 2001 From: qb <1191961160@qq.com> Date: Thu, 20 Jun 2024 16:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=93=81=E7=89=8C=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/basicdata/brand/basicBrand.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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);