Home > Web Front-end > uni-app > How to change icon color in uniapp

How to change icon color in uniapp

藏色散人
Release: 2023-01-13 00:44:30
Original
6759 people have browsed it

How to change the icon color in uniapp: first introduce iconfont.js into the project; then set the color through the "" method; and finally modify the icon size.

How to change icon color in uniapp

The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.

Recommended (free): uni-app tutorial

Introducing colored icons

1. Introduce iconfont.js

// main.js
import './assets/iconfont.js'
Copy after login

2. Use

<svg class="icon" aria-hidden="true">
  <use xlink:href="#qc-icecream"></use>
</svg>
Copy after login

3. Modify the size

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

The above is the detailed content of How to change icon color in uniapp. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template