[FAQ] 如何从 svg 字符串创建 SVGElement
HTML 部分:
<div style="display: none" id="svgCon"></div>
JS 部分:
const svgCon = document.getElementById('svgCon') svgCon.innerHTML = '<svg>xxxxx'; const svg = svgCon.querySelector('svg')
Ref:SVGElement
Ref:https://so.muouseo.com/qa/9yp682qre6nk.html