圖片:
.jpeg格式:image/jpeg
.png格式: image/png
.gif格式: image/gif
音頻:
.mp3格式:audio/mpeg
視頻:
.mp4格式:video/mp4
.m3u8格式:application/x-mpegURL
.mov格式:video/x-ms-wmv
.avi格式:video/x-msvideo
.flv格式:video/x-flv
.wmv格式:video/x-ms-wmv
文本:
.xls格式:application/vnd.ms-excel
.xlsx格式:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.doc格式:application/msword
.docx格式:application/vnd.openxmlformats-officedocument.wordprocessingml.document
.txt格式:text/plain
.pdf格式:application/pdf
.ppt格式:application/vnd.ms-powerpoint
.zip格式:application/zip
.rar格式:application/x-rar
//校驗版塊 //校驗---{上傳成員頭像}前圖片格式及大小 AvatarUpload(file) { const isJPG = file.type === 'image/jpeg'; const isLt2M = file.size / 1024 / 1024 < 2; if(['image/jpeg','image/PNG'].indexOf(File.type) == -1) { this.$message.error('上傳頭像圖片只能是 JPG/PNG 格式!'); return false; } if (!isLt2M) { this.$message.error('上傳頭像圖片大小不能超過 2MB!'); } return isJPG && isLt2M; }, //校驗---{上傳視頻}前進行格式校驗 videoUpload(file) { const isLt50M = file.size / 1024 / 1024 < 50; if (['video/mp4', 'video/ogg', 'video/flv','video/avi','video/wmv','video/rmvb'].indexOf(file.type) == -1) { this.$message.error('請上傳正確的視頻格式'); return false; } if (!isLt50M) { this.$message.error('上傳視頻大小不能超過50MB哦!'); return false; } }, //校驗---{上傳ppt}前進行格式校驗 pptUpload(file) { if (['application/vnd.ms-powerpoint'].indexOf(file.type) == -1) { this.$message.error('請上傳正確的ppt格式'); return false; } }, //校驗---{上傳商業企划書}前進行格式校驗 doxrUpload(file) { if (['application/vnd.ms-powerpoint', 'application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/pdf' ].indexOf(file.type) == -1) { this.$message.error('請上傳正確類型的文件格式'); return false; } },