feat: 上传限制

This commit is contained in:
wangdan-fit2cloud 2024-03-01 15:58:47 +08:00
parent 4054244f65
commit 1fdbf5de54

View File

@ -17,6 +17,8 @@
:auto-upload="false" :auto-upload="false"
:show-file-list="false" :show-file-list="false"
accept=".txt, .md" accept=".txt, .md"
limit="50"
:on-exceed="onExceed"
> >
<img src="@/assets/upload-icon.svg" alt="" /> <img src="@/assets/upload-icon.svg" alt="" />
<div class="el-upload__text"> <div class="el-upload__text">
@ -77,6 +79,9 @@ function deleteFlie(index: number) {
form.value.fileList.splice(index, 1) form.value.fileList.splice(index, 1)
} }
const onExceed = () => {
MsgError('每次最多上传50个文件')
}
/* /*
表单校验 表单校验
*/ */
@ -86,6 +91,7 @@ function validate() {
return valid return valid
}) })
} }
onMounted(() => { onMounted(() => {
if (documentsFiles.value) { if (documentsFiles.value) {
form.value.fileList = documentsFiles.value form.value.fileList = documentsFiles.value