diff --git a/src/components/Upload/Images.vue b/src/components/Upload/Images.vue index 0bac0de..2062ab1 100644 --- a/src/components/Upload/Images.vue +++ b/src/components/Upload/Images.vue @@ -120,6 +120,13 @@ const handleHttpUpload = async (options) => { loading.value = true; try { + if (props.limit && props.fileList.length >= props.limit) { + notification.warning({ + message: '温馨提示', + description: `最多支持上传${props.limit}张`, + }); + return false; + } const formData = new FormData(); formData.append('file', options.file); formData.append('name', props.name); @@ -188,6 +195,13 @@ let filePath = props.name + '/' + year + '/' + month + '/' + day + '/' + fileName; loading.value = true; try { + if (props.limit && props.fileList.length >= props.limit) { + notification.warning({ + message: '温馨提示', + description: `最多支持上传${props.limit}张`, + }); + return false; + } const headers = { 'Access-Control-Allow-Origin': '*', };