ota文件大小限制
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
export default {
|
||||
name: 'file',
|
||||
props: ['disableds', 'disabled', 'thisFileUploadUrl','acceptcode', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
|
||||
props: ['disableds', 'disabled', 'thisFileUploadUrl','size' ,'acceptcode', 'readonly', 'thisFileType', 'isUploadFile', 'isMultiple', 'restrictUploads', 'Uploadable'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
@@ -98,6 +98,15 @@
|
||||
return false
|
||||
}
|
||||
}
|
||||
// 根据大小拦截
|
||||
if(this.size){
|
||||
const isLt2KB = file.size / 1024 /1024 < this.size
|
||||
let name = file.name
|
||||
if (!isLt2KB) {
|
||||
this.$message.error(name + this.$t('uploadedfilelarger'))
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (this.isMultiple) {
|
||||
if ((this.myfileList && this.myfileList.length == 1) || this.myfileList && this.myfileList.length > 1) {
|
||||
this.$message.warning(this.$t('onlyOnefileUploaded'))
|
||||
|
||||
Reference in New Issue
Block a user