iconfont symbol reference, display color font icons

1. Go to the Alibaba icon library to find your own project, select symbol, and download it locally.
Insert picture description here
2. Unzip the downloaded file to find the iconfont.js file, and copy it to the project. I created a new folder named iconfont under static.
Insert picture description here
3. And create a new icon.css file in the same level directory

Insert picture description here
4. Paste the following code in icon.css.

General css code:

.icon {
width: 1em; height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}

5. Import in main.js

import './assets/iconfont/iconfont.js'
import './assets/iconfont/icon.css'

Insert picture description here
6. So it can be used

<span class="svg-container">
	<svg class="icon" aria-hidden="true">
	<use xlink:href="#iconpingjia_yidianji"></use>
	</svg>
</span>

The user name after xlink: href can be seen on the official website of lconfont -> right-click the icon to copy the code

7. Effect picture:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44433499/article/details/113341775