man15h / vue-cryptoicon

Cryptocurrency icons for your next Vue project
https://vue-cryptoicon.netlify.com/
MIT License
100 stars 27 forks source link

Integration in Nuxt 3 #16

Open toniengelhardt opened 1 year ago

toniengelhardt commented 1 year ago

I have trouble getting it to work with Nuxt 3.

Should it not be registered in a plugin like:

import Cryptoicon from 'vue-cryptoicon'
import icon from 'vue-cryptoicon/src/icons'
import { defineNuxtPlugin } from '#app'

export default defineNuxtPlugin((nuxtApp) => {
  Cryptoicon.add(icon)
  nuxtApp.vueApp.use(Cryptoicon)
})

?

Screenshot 2023-01-06 at 19 05 21
toniengelhardt commented 1 year ago

Update

The following seems to work:

import CryptoIcon from 'vue-cryptoicon/src/components/Cryptoicon'
import icon from 'vue-cryptoicon/src/icons'
import { defineNuxtPlugin } from '#app'

export default defineNuxtPlugin((nuxtApp) => {
  CryptoIcon.add(icon)
  nuxtApp.vueApp.component('CryptoIcon', CryptoIcon)
})

Adapted from https://github.com/man15h/vue-cryptoicon/issues/7.