|
|
@@ -8,7 +8,7 @@
|
|
|
:disabled="isedit ? coverFileList.length > 0 && isedit : coverFileList.length > 0"
|
|
|
>选择图片</a-button
|
|
|
>
|
|
|
- <span style="margin-left: 10px">仅支持上传jpg/png格式文件,单个文件不能超过500kb</span>
|
|
|
+ <span style="margin-left: 10px">仅支持上传jpg/png格式文件,单个文件不能超过{{props.sizeMax}}}kb</span>
|
|
|
</div>
|
|
|
<a-upload
|
|
|
ref="upload"
|
|
|
@@ -49,6 +49,10 @@
|
|
|
required: true,
|
|
|
default: null
|
|
|
},
|
|
|
+ sizeMax: {
|
|
|
+ type: Number,
|
|
|
+ default: 5000
|
|
|
+ },
|
|
|
imageUrl: {
|
|
|
type: String,
|
|
|
required: true,
|
|
|
@@ -96,9 +100,9 @@
|
|
|
}
|
|
|
|
|
|
// 验证文件大小(500KB限制)
|
|
|
- const isLt500K = file.size / 1024 < 500
|
|
|
+ const isLt500K = file.size / 1024 < props.sizeMax
|
|
|
if (!isLt500K) {
|
|
|
- message.error('文件大小不能超过500KB!')
|
|
|
+ message.error(`文件大小不能超过${props.sizeMax}KB!`)
|
|
|
return false
|
|
|
}
|
|
|
|