媒体库增加文件上传类型

This commit is contained in:
jacky 2024-05-11 22:50:31 +08:00
parent 350913c2fb
commit b1b60bc309
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,7 @@ const uploadData = ref({
category: props.category
})
const beforeUpload = (file) => {
console.log('file.type', file.type)
const isDocument = isDocumentMime(file.type)
const isZip = isZipMime(file.type)
const isLt500K = file.size / 1024 / 1024 < 0.5 // 500K, @todo
@ -39,7 +40,7 @@ const beforeUpload = (file) => {
const isImage = isImageMime(file.type)
if (!isVideo && !isImage && !isDocument && !isZip) {
ElMessage.error('上传图片只能是 jpg,png,svg,webp 格式, 上传视频只能是 mp4,webm 格式,上传文件只能是 txt,pdf,doc,docx,xls,xlsx,ppt,pptx,zip,rar!')
ElMessage.error('上传图片只能是 jpg,png,svg,webp 格式, 上传视频只能是 mp4,webm 格式,上传文件只能是 txt,pdf,doc,docx,xls,xlsx,ppt,pptx,wps,et,dps,zip,rar!')
return false
}
if (isDocument && !isLt20M) {