Bug: TypeError: Cannot read properties of undefined (reading 'replace')
Kabuda-czh opened this issue · 0 comments
Kabuda-czh commented
在使用 jsx
写 svg
内部的 text
标签会报错
<svg viewBox="0 0 100 100">
<circle
cx="50"
cy="50"
r="50"
fill="none"
stroke="#ccc"
strokeWidth="10"
/>
<circle
cx="50"
cy="50"
r="50"
fill="none"
stroke="#f00"
strokeWidth="10"
strokeDasharray={2 * Math.PI * 50}
strokeDashoffset={2 * Math.PI * 50 * (1 - 0.8)}
transform="rotate(-90, 50, 50)"
/>
<text
x="50"
y="50"
textAnchor="middle"
dominantBaseline="middle"
fontSize="20"
fill="#000"
>
{`${Math.floor(0.8 * 100)}%`}
</text>
</svg>