有角度的闪烁图标

问题描述

我用 Angular 11 和 bootstrap 以及 bootstrap-icons 实现了一个简单的按钮。 当我路由显示按钮的页面时,该按钮会立即加载。但只有当大约 500 毫秒过去时,图标才会弹出并且看起来像是在闪烁。

我怎样才能摆脱这种行为?列表视图等中的图标也会出现这种情况。

 <button
  type="button"
  class="btn btn-secondary float-right w-25 mb-3"
 >
  <svg width="24" height="24">
    <use xlink:href="assets/bootstrap-icons/bootstrap-icons.svg#plus" />
  </svg>
  Test
</button>

enter image description here

enter image description here

解决方法

您可以使用以下 npm 命令将引导程序图标直接安装到您的 angular 项目中。

npm i bootstrap-icons

然后使用图标如下。 (例如:+ 图标)

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">
   <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>
</svg>

这将消除闪烁行为。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...