离子svg-图标-更改背景颜色

我在应用程序中使用svg-icons,问题是是否有必要在其中放置不同颜色的图标,或者是否可以通过代码设置颜色。这是我的方法:

app.scss:
ion-icon {
  &[class*="custom-"] {
    mask-size: contain;
    mask-position: 50% 50%;
    mask-repeat: no-repeat;
    background: currentColor;
    width: 1em;
    height: 1em;
  }

  &[class*="custom-mobile"] {
    background: url(../assets/mobile.svg);
  }


}

视图:

<ion-item>
      <ion-icon name="custom-mobile"></ion-icon>
</ion-item>

我更改了课堂部分的背景颜色,但对视图没有影响。

zsg12345 回答:离子svg-图标-更改背景颜色

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3103838.html

大家都在问