From 924b5f42c6de875bcec9464deb2f4e5081e8d23a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?=
{{this.$t('clickUpload')}}
+{{this.$t('uploadFile.clickUpload')}}
@@ -48,7 +43,8 @@ export default { myFileList: [], headers: '', previewImage: {}, - uploadFileFlag: 0 + uploadFileFlag: 0, + fileMaxSize: 500 } }, created () { @@ -72,6 +68,18 @@ export default { } }, beforeUpload (file) { + file.uploadGoOn = true + const fileSize = file.size // 上传的文件大小 + if (fileSize === 0) { + this.$message.warning(this.$t('uploadFile.cannotUploadEmpty')) + file.uploadGoOn = false + return false + } + if (this.fileMaxSize && fileSize > 1024 * 1024 * this.fileMaxSize) { + this.$message.warning(this.$t('uploadFile.pleaseUpload') + this.fileMaxSize + this.$t('uploadFile.theFollowingDocuments')) + file.uploadGoOn = false + return false + } let fileFlag = false // console.log('accept',this.accept,file) this.fileTypeSatus = false