NuxtN
Nuxt16mo ago
6 replies
Raphael

Why does UButton icon 404 error unless icon is separately pre-loaded?

Relevant chunk of code:

ColorScheme placeholder="" tag="span">
   <UButton
    v-model="isDark" :icon="isDark ? 'i-fa-moon-o' : 'i-fa-sun-o'" @click="toggleColourMode">    </UButton>
</ColorScheme>


By itself I get the error: "Failed to load resource: the server responded with a status of 404 ()"

However it works if after the above I add:

<Icon name="fa:sun-o" class="w-0 h-0"></Icon>
<Icon name="fa:moon-o" class="w-0 h-0"></Icon>


Is there a less hacky way to preload icons? I tried loadIcons() but that didn't work.

Thanks!!
Was this page helpful?