perf(projects): 增强文件校验的兼容性 (#1931)

This commit is contained in:
青菜白玉汤
2024-11-10 17:02:31 +08:00
committed by GitHub
parent 7d9af64f6d
commit f63803529a
5 changed files with 21 additions and 17 deletions

View File

@@ -38,8 +38,8 @@
})
const beforeImageUpload = (file) => {
const isJPG = file.type === 'image/jpeg'
const isPng = file.type === 'image/png'
const isJPG = file.type?.toLowerCase() === 'image/jpeg'
const isPng = file.type?.toLowerCase() === 'image/png'
if (!isJPG && !isPng) {
ElMessage.error('上传头像图片只能是 jpg或png 格式!')
return false