Closed darthf1 closed 4 years ago
We are considering making nuxt starter pack in PRO version, for now, we have the 'basic starter' and the 'typescript starter' available. Anyway, starters are PRO version features.
Nevertheless, it is appreciated if you make your own nuxt version, but we will not maintain it. We will link to such a version in our README.
Concerning your problem, did you try passing 'icons' object to the context? https://nuxtjs.org/api/context/
The message in CIcon could be more informative (vue is passing icons to $options.icons automatically)
Ok, thanks.
Thanks for your suggestion regarding the context
! Leaving the solution here for reference:
import { iconsSet } from 'assets/icons/icons'
import { NuxtAppOptions, Plugin } from '@nuxt/types'
import Vue, { VueConstructor } from 'vue'
import { CIcon } from '@coreui/icons-vue'
declare module '@nuxt/types' {
interface NuxtAppOptions {
icons: { [key: string]: string[] }
}
}
const CoreUiIconComponent = {
install(Vue: VueConstructor): void {
Vue.component('c-icon', CIcon)
}
}
Vue.use(CoreUiIconComponent)
const coreUiIcons: Plugin = ({ app }) => {
app.icons = iconsSet
}
export default coreUiIcons
Concerning nuxt template, there already exist such project, and it will be updated to version 3 https://github.com/muhibbudins/nuxt-coreui/issues/15
For nuxt.js, we can use a vanilla plugin as follows... import Vue from 'vue' import { iconsSet } from 'assets/icons/icons' import { CIcon } from '@coreui/icons-vue'
Vue.component('c-icon', CIcon)
export default ({ app }) => { app.icons = iconsSet }
Hi, have you any docs on how to implement it in nuxt? :) i've tried but it's not working, maybe i've done it wrong but i'm note sure
Hi, I'm wondering if you're willing to provide instructions to install this template in Nuxt? I'm willing to provide a PR, but I need help with the icons.
To install
@coreui/vue
, you need to create a Nuxt plugin:~/plugins/coreui.ts
Then, in
/nuxt.config.ts
:Then if you copy the template files from this repo to the corresponding folders you're good to go.
The issue is with the icons, which don't show. In the template, the icons are installed as
Vue component options
in main.jsI tried the same by making
icons
available throughWhich makes it available on
this.$root.icons
, but still no icons showing. I also tried it throughVue.extend
, but i get the same result.In the console, i get the following warning:
But I guess this is related to the misconfiguration of the icons on my end, resulting in faulty html because the value between
<svg>
tags is currentlyundefined
In CIconRaw.vue line 55-58, I noticed the following code:
An icon is created by searching in
this.$root.$options.icons
but the error is referring tothis.$root.icons
. Is this correct?