【发布时间】:2021-06-13 21:05:00
【问题描述】:
我正在尝试使用这个渐变,我的组件目前位于我的应用程序的根目录中,我尝试像某些解决方案一样将 <base href="/"> 放入索引中,并且还尝试了 APP_BASE_HREF 但没有这两个似乎工作。我不需要指定路径,因为这个路径已经在 app.component.html
<svg
attr.height="{{radius * 2}}"
attr.width="{{radius * 2}}"
>
<defs>
<lineargradient id="grad" x1="0" y1="0" x2="1" y2="1">
<stop offset="15%" stop-color="#FFF" stop-opacity="1"></stop>
<stop offset="85%" stop-color="#000" stop-opacity="1"></stop>
</lineargradient>
</defs>
<circle
class="gauge_base"
attr.cx="{{radius}}"
attr.cy="{{radius}}"
stroke="gray"
attr.r="{{innerRadius}}"
stroke-width="6px"
attr.transform="{{transform}}"
stroke-linecap="round"
fill="transparent"
attr.stroke-dasharray="{{dashArray}}"
/>
<circle
class="gauge_pourcentage"
attr.cx="{{radius}}"
attr.cy="{{radius}}"
attr.r="{{innerRadius}}"
stroke="url(#grad)"
attr.stroke-dasharray="{{dashArray}}"
stroke-width="12px"
attr.stroke-dashoffset="{{offset}}"
attr.transform="{{transform}}"
style="transition: stroke-dashoffset 0.3s"
stroke-linecap="round"
fill="transparent"
/>
</svg>
【问题讨论】:
-
我已经在里面尝试过了,但没有任何作用,仍然不起作用@RobertLongson