vue-fontawesome icon indicating copy to clipboard operation
vue-fontawesome copied to clipboard

Error event when icon cannot be resolved

Open TheAlexLichter opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. Hey! 👋 Right now it is difficult to handle edge cases when icons cannot be resolved (think of e.g. user input) and to show a default icon in this case.

Describe the solution you'd like It would be helpful if the component could emit an error event that parent components can listen to and act accordingly instead of just logging the error.

Describe alternatives you've considered Right now, only checking the DOM manually, which is tedious 😂

TheAlexLichter avatar Aug 08 '22 15:08 TheAlexLichter

+1 AFAIK right now you have to check your input like

<template>
    <font-awesome-icon v-if="icons.includes(userInput)" :icon="['fab', userInput]"></font-awesome-icon>
</template>

<script setup>
    import { fab } from '@fortawesome/free-brands-svg-icons'
    const icons = Object.values(fab).map(v => v.iconName)
    const userInput = ref('twitter')
</script>

chemtrails avatar Jan 15 '24 00:01 chemtrails