【fix】bug83096 -上传图片限制死类型
This commit is contained in:
@@ -83,9 +83,10 @@ export default {
|
|||||||
let fileFlag = false
|
let fileFlag = false
|
||||||
// console.log('accept',this.accept,file)
|
// console.log('accept',this.accept,file)
|
||||||
this.fileTypeSatus = false
|
this.fileTypeSatus = false
|
||||||
const fileTypes = this.accept.split('/')
|
// const fileTypes = this.accept.split('/')
|
||||||
const fileNowTypes = file.type.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)
|
// console.log('filetype',fileFlag)
|
||||||
if (!fileFlag) {
|
if (!fileFlag) {
|
||||||
this.$message.warning(this.$t('uploadFile.fileFormatIncorrect'))
|
this.$message.warning(this.$t('uploadFile.fileFormatIncorrect'))
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export default {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
titleImg: this.$t('uploadPictures'),
|
titleImg: this.$t('uploadPictures'),
|
||||||
listType: 'picture',
|
listType: 'picture',
|
||||||
accept: 'image/*',
|
accept: '.png,.jpeg,.jpg,.gif',
|
||||||
// 表格行列相关数据
|
// 表格行列相关数据
|
||||||
rowColForm: {},
|
rowColForm: {},
|
||||||
validatorRowColRules: {
|
validatorRowColRules: {
|
||||||
|
|||||||
Reference in New Issue
Block a user