-
翻阅古今
const format = (/\.(\S+)$/.exec(res) || [,''])[1].toLowerCase()const iconMap = { _default: 'war_icon.png', doc: 'word.png', docx: 'word.png', pdf: 'pdf_icon.png', rar: 'rar_icon.png', tif: 'tif_icon.png', xls: 'xls_icon.png', xlsx: 'xls_icon.png', zip: 'rar_icon.png',}const cache = require(`../assets/inmages/FileTypeIcon/${iconMap[format] || iconMap._default}`)
-
哆啦的时光机
var cache = ''if (/^docx?$/i.test(format)) {} else if (/^pdf$/i.test(format)) {} else if (/^(zip|rar)$/i.test(format)) { } else if (/^xlsx?$/i.test(format)) { } else if (/^tif$/i.test(format)) { } else { }
-
慕丝7291255
var cache = require('../assets/inmages/FileTypeIcon/'+( ['doc','DOC','docx','DOCX'].includes(format)?"word" :['pdf','PDF'].includes(format)?"pdf_icon" :['zip','ZIP','rar'].includes(format)?"rar_icon" :['xls','XLS','xlsx','XLSX'].includes(format)?"xls_icon" :['tif','TIF'].includes(format)?"tif_icon":"war_icon")+'.png')
-
江户川乱折腾
function docType(str){ let cache = ''; str = str.toLowerCase(); switch(str){ case 'doc': case 'docx: cache = '../assets/images/filetypeIcon/word.png' break; case 'pdf': cache = '../assets/images/filetypeIcon/pdf_icon.png' break; .... defalut: cache = '../assets/images/filetypeIcon/war_icon.png'; }; return cache;}