; and finally modify the icon size."/> ; and finally modify the icon size.">

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

How to change icon color in uniapp

藏色散人
藏色散人Original
2021-01-18 11:31:306704browse

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'

2. Use

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

3. Modify the size

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

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!

Statement:
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