feat: 凭证上传的图片加了大小限制,10mb
This commit is contained in:
parent
3c03eaf353
commit
e99febec4e
@ -148,6 +148,7 @@
|
||||
list-type="image-card"
|
||||
:max="1"
|
||||
accept="image/png,image/jpeg,image/jpg"
|
||||
@before-upload="beforeUpload"
|
||||
@finish="handleUploadFinish"
|
||||
@remove="deleteUpload"
|
||||
>
|
||||
@ -312,6 +313,16 @@ const deleteUpload = () => {
|
||||
uploadedFile.value = ''
|
||||
}
|
||||
|
||||
const beforeUpload = (data) => {
|
||||
const file = data.file.file
|
||||
const isLt10M = file.size / 1024 / 1024 < 10
|
||||
if (!isLt10M) {
|
||||
message.error('图片大小不能超过10MB,请重新上传')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 提交上传
|
||||
function handleUploadSubmit() {
|
||||
if (!isFormValid.value) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user