atisawd / boxicons

High Quality web friendly icons
https://boxicons.com
MIT License
2.95k stars 295 forks source link

How use in vue components? #268

Open atach opened 2 years ago

atach commented 2 years ago

Tell me how I can use icons in a project with a vue3

Снимок экрана 2022-01-05 в 11 39 18

?

sourabh99967780 commented 2 years ago

First, install boxicons via npm, not cdn.

npm install boxicons --save

Then import Boxicons in the script section of your App.vue.

import 'boxicons';

Done. It should be now accessible everywhere in your Vue App like this.

<template>
    <box-icon name="save"></box-icon>
</template>
shershen08 commented 2 years ago

I see the following warning in the console

[Vue warn]: Failed to resolve component: box-icon
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

using Vue 3 + TS

swpfY commented 1 year ago

I see the following warning in the console

[Vue warn]: Failed to resolve component: box-icon
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

using Vue 3 + TS

You can solve the problem by following this answer: https://stackoverflow.com/a/71602929