8/1 限制前端输入字数

This commit is contained in:
Zy
2026-08-01 10:11:38 +08:00
parent 2907f9202c
commit ca5f214bac
33 changed files with 271 additions and 253 deletions

View File

@@ -82,7 +82,8 @@
v-model:file-list="fileList"
:action="uploadUrl"
list-type="picture-card"
:limit="1"
:limit="9"
:on-exceed="handleExceed"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:before-upload="handleChangeFile"
@@ -213,6 +214,9 @@ const handleChangeFile: UploadProps['beforeUpload'] = (rawFile: UploadRawFile) =
return true;
};
const handleExceed: UploadProps['onExceed'] = () => {
ElMessage.warning(`最多只能上传 9 个文件`);
};
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
dialogImageUrl.value = uploadFile.url!;
dialogVisible.value = true;