【fix】bug83096 -上传图片限制死类型

This commit is contained in:
fengchenchen
2024-03-27 11:39:31 +08:00
parent 136baa0c22
commit a7e094f137
2 changed files with 4 additions and 3 deletions
@@ -83,9 +83,10 @@ export default {
let fileFlag = false
// console.log('accept',this.accept,file)
this.fileTypeSatus = false
const fileTypes = this.accept.split('/')
// const fileTypes = this.accept.split('/')
const fileNowTypes = file.type.split('/')
fileFlag = (fileTypes[0] === fileNowTypes[0])
// 修改判断方法 限制jpg\jpeg\png\gif 可以上传 其他不能上传。
fileFlag = (['PNG', 'JPEG', 'PNG', 'GIF'].includes(fileNowTypes[1].toUpperCase()))
// console.log('filetype',fileFlag)
if (!fileFlag) {
this.$message.warning(this.$t('uploadFile.fileFormatIncorrect'))
@@ -128,7 +128,7 @@ export default {
disabled: false,
titleImg: this.$t('uploadPictures'),
listType: 'picture',
accept: 'image/*',
accept: '.png,.jpeg,.jpg,.gif',
// 表格行列相关数据
rowColForm: {},
validatorRowColRules: {