设置上传文件的大小

liutao_branch
liutao 2 months ago
parent f91a450420
commit 487dc2ecf7

@ -58,6 +58,7 @@
v-model:file-list="fileList"
:action="uploadUrl"
:auto-upload="false"
:before-upload="beforeUpload"
:data="data"
:disabled="isEdit"
:limit="1"
@ -155,6 +156,13 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const handleFileChange = (file) => {
data.value.path = file.name
}
const beforeUpload = (file) => {
const isLt2M = file.size / 1024 / 1024 < 100
if (!isLt2M) {
message.error('上传文件大小不能超过 100MB!')
}
return isLt2M
}
/** 提交表单 */
const submitFileForm = async () => {

Loading…
Cancel
Save