This commit is contained in:
2026-07-14 16:40:42 +08:00
parent 33687bbd66
commit 2168888ca7
149 changed files with 2784 additions and 692 deletions
@@ -133,6 +133,12 @@ module.exports = {
default: 1024 * 1024 * 10,
required: false
},
// 是否限制上传文件大小,默认保留原有大小校验逻辑。
limit_upload_size: {
type: Boolean,
default: true,
required: false
},
// 上传按钮文字
upload_text: {
type: String,
@@ -216,7 +222,7 @@ module.exports = {
} else {
tips = tips + '不限格式;'
}
if (fileSize) {
if (this.limit_upload_size && fileSize) {
tips = tips + `单个文件大小不能超过<span style="color: red">${fileSize / 1024 / 1024}</span>M`
}
return tips
@@ -313,7 +319,8 @@ module.exports = {
// 这是兜底逻辑,保准只让这个image类型上传图片
beforeUpload(file) {
if (file.size > this.upload_size) {
// 需要兼容部分业务不限制附件大小,关闭后仅跳过大小校验,不影响数量和格式控制。
if (this.limit_upload_size && file.size > this.upload_size) {
this.$message.error("文件过大,请上传小于" + (this.upload_size / 1024 / 1024).toFixed(0) + "M的文件!")
return false
}