switch(type) {
case "image/svg": {
return <i class="fas file-icon fa-image"></i>
}
case "image/jpeg": {
return <i class="fas file-icon fa-image"></i>
}
case "image/jpg": {
return <i class="fas file-icon fa-image"></i>
}
}
<template>
<i :class="getIconNameByType(type)"/>
</template>
setup () {
function getIconNameByType (type) {
const iconsMap = {
'image/svg': 'fas file-icon fa-image',
'image/jpeg': 'fas file-icon fa-image',
'image/jpg': 'fas file-icon fa-image',
'text/javascript': 'fas file-icon fa-image',
// ....
};
return iconsMap[type];
}
return {
getIconNameByType
};
}