在::before
伪元素的CSS代码中,我希望根据在Reaction组件中 Select 的 colored颜色 动态更改框阴影 colored颜色 .
react 部分
<>
<div className="card">
<div className="percent">
<div
className="dot"
style={{
transform: `rotate(${3.6 * off}deg)`,
}}
></div>
<svg>
<circle cx={70} cy={70} r={70}></circle>
<circle
cx={70}
cy={70}
r={70}
style={{
stroke: colors,
strokeDasharray: 440,
strokeDashoffset: 440 - (440 * off) / 100,
}}
></circle>
</svg>
</div>
</div>
</>
Css部件
.dot {
position: absolute;
inset: 5px;
z-index: 10;
animation: anmationdot 2s linear forwards;
}
@keyframes anmationdot {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(calc(3.6 * 85));
}
}
.dot::before {
content: "";
position: absolute;
top: -5px;
left: 50%;
transform: translateX(-50%);
width: 10px;
height: 10px;
border-radius: 50%;
background-color: aqua;
box-shadow: 0 0 10px aqua, 0 0 30px aqua;
}
我在try 使用样式并将其作为根元素从Reaction发送时遇到错误.