The use of svg in vue projects

Share the process of using svg files in projects.

1. Download dependency packages

npm and [email protected]

2. Configure vue.config.js

Insert image description here

3. Create the src/icons folder, store all svg files here, import all svg files in index.js inside, and register global components.

Insert image description here

Insert image description here
Insert image description here

4. Directly import the svg configuration in main.js

Insert image description here

5. Use svg files in pages

<svg-icon icon-class="button"/>

Guess you like

Origin blog.csdn.net/m0_52043522/article/details/125378351