You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the <CIcon> component there's a [Vue warn] printed in the console: injection "icons" not found..
Expected behavior
No warning printed in the console if there's no "icons" injection.
Details
This happens because in the first line of the CIconsetup() function there's a call to inject('icons'). This gives a warning if there's no injection provided using provide('icons', ...). The documentation doesn't mention this, and also it's not necessary to do this since you can alternatively import an icon and pass it to <CIcon :icon="icon"> directly.
To prevent this warning there should be a default value provided like this: const icons = inject('icons', null). Then handle null accordingly.
The text was updated successfully, but these errors were encountered:
But, after I noticed that in my case I can not use string icons as props if I don't provide icons of @coreui/icons, since that I rewrote the code with:
import * as icons from '@coreui/icons'
const nuxtApp = useNuxtApp()
nuxtApp.vueApp.provide('icons', icons)
Current behavior
When using the
<CIcon>
component there's a[Vue warn]
printed in the console:injection "icons" not found.
.Expected behavior
No warning printed in the console if there's no "icons" injection.
Details
This happens because in the first line of the
CIcon
setup()
function there's a call toinject('icons')
. This gives a warning if there's no injection provided usingprovide('icons', ...)
. The documentation doesn't mention this, and also it's not necessary to do this since you can alternatively import an icon and pass it to<CIcon :icon="icon">
directly.To prevent this warning there should be a default value provided like this:
const icons = inject('icons', null)
. Then handlenull
accordingly.The text was updated successfully, but these errors were encountered: