Home>Article>Web Front-end> An article explaining in detail how to introduce SVG icons in Vue3 projects
How to introduce SVG icons into Vue3 projects? The following article will introduce to you how to introduce iconfont icons into Vue3 projects. I hope it will be helpful to you!

Through the previous period of learningExpressandMysql
Here we try to build abackend systemto consolidate the learning technology.
Since it is a page, it must be inseparable from some iconsicon, so be sure to go to the most completeAlibaba icon Libraryto find
Here we explain how to put the contents ofAlibaba Icon Libraryon our page
Enter the page, findResource ManagementbelowMy Project, and create the project
settings As follows

After creating the project, we enterAli’s material libraryto find some icons we need later,
and add them Go toShopping Cart,
Add the icon inShopping Cartto the project
SymbolandDownload it locally
src\assets\svgdirectory
Unzip it and delete unnecessary Just leave theiconfont.jsfile
main.ts
import './assets/svg/iconfont.js'
srcdirectory, create a directory for storing plug-insplugin
// index.vue
// index.ts import { App } from 'vue' import SvgIcon from './index.vue' export function setupSvgIcon(app: App) { app.component('SvgIcon', SvgIcon) }Then register the component in
main.ts
import { setupSvgIcon } from './plugin/SvgIcon/index' setupSvgIcon(app)Use it in the page
工作台页面
SVGicon is successfully displayed
Express-Mysql-Vue3-TS-PiniaMake abackend systemproject
Introduce Alibaba TheSVGicon into the project.
[Related recommendations:vuejs introductory tutorial]
The above is the detailed content of An article explaining in detail how to introduce SVG icons in Vue3 projects. For more information, please follow other related articles on the PHP Chinese website!