tabler / tabler-icons

A set of over 5500 free MIT-licensed high-quality SVG icons for you to use in your web projects.
https://tabler.io/icons
MIT License
18.03k stars 899 forks source link

How to use icon in Nuxt JS? #840

Closed joewilson27 closed 1 year ago

joewilson27 commented 1 year ago

Hi, I'm new to this awesome library. I can use them in vue perfectly, but when I use NuxtJS, it doesn't work... I have installed tabler/core and tabler/icons and put that on nuxt config, but still didn't work... Can you guys give an simple example?

roiLeo commented 1 year ago

Hello it does work for me https://stackblitz.com/edit/nuxt-starter-xhys4j?file=app.vue

which version of Nuxt are you using? did you install @tabler/icons-vue package?

joewilson27 commented 1 year ago

@roiLeo

Hi, thanks for answer..

I'm using nuxt version ^2.15.8 and surely I did install @tabler/icons-vue

I have tried just just like your example, import the icon in vue component but it was error... should I upgrade my nuxt to version 3.x.x ?

joewilson27 commented 1 year ago

@roiLeo

this is my package json

Screenshot 2023-09-18 at 23 32 13

icons vue in my node_modules

Screenshot 2023-09-18 at 23 38 54

this is my define component

Screenshot 2023-09-18 at 23 34 41

and then I call them in the same file component as declare the HomeIcon above

Screenshot 2023-09-18 at 23 36 15

Then this is error what I got

Screenshot 2023-09-18 at 23 34 02
roiLeo commented 1 year ago

Looks like this package only work with Vue3, consider using new nuxt version

joewilson27 commented 1 year ago

thanks @roiLeo

it seems the issue was clear, it's about the version compatibility..

thanks