附件格式
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
export default {
|
||||
name: 'file',
|
||||
props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
|
||||
props: ['disableds', 'disabled', 'thisFileUploadUrl','accept', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
@@ -88,6 +88,16 @@
|
||||
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
|
||||
console.log(file)
|
||||
this.fileTypeSatus = true
|
||||
//根据格式拦截
|
||||
if(this.accept){
|
||||
let fileNames = file.name.split('.')
|
||||
let fileType = fileNames[fileNames.length - 1].toLocaleLowerCase()
|
||||
let extList = this.accept.split(',')
|
||||
if (!extList.find((item) => item == fileType)) {
|
||||
this.$message.error(this.$t('uploadOnly') + this.accept + this.$t('type'))
|
||||
reject(false)
|
||||
}
|
||||
}
|
||||
if (this.isMultiple) {
|
||||
if ((this.myfileList && this.myfileList.length == 1) || this.myfileList && this.myfileList.length > 1) {
|
||||
this.$message.warning(this.$t('onlyOnefileUploaded'))
|
||||
@@ -121,6 +131,7 @@
|
||||
// }else{
|
||||
// this.fileTypeSatus = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
this.$message.destroy()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user