el-upload + accept限制上传的文件格式
转载/**
* kevin 2021/1/4
* @description el-upload + accept限制上传的文件格式
* @param e 校验的类型
* @returns {string | null}
*/
export function acceptFile(e) {
const allowHook = {
video: '.mp4, .ogv, .ogg, .webm',
audio: '.wav, .mp3, .ogg, .acc, .webm, .amr',
file: 'doc,.docx,.xlsx,.xls,.pdf',
excel: 'xlsx,.xls',
img: '.jpg, .jpeg, .png, .gif'
}
if (e) {
return allowHook[e]
}
let srt = null
for (const k in allowHook) {
srt += allowHook[k]
}
return srt
}
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
下一篇:稀疏数组
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章