img.src = 'data:image/svg+xml;charset=utf-8,<svg xmlns="
http://www.w3.org/2000/svg" width="' + box.offsetWidth + '" height="' + box.offsetHeight + '"><foreignObject x="0" y="0" width="100%" height="100%">'+
new XMLSerializer().serializeToString(box).replace(/#/g, '%23').replace(/\n/g, '%0A') +
'</foreignObject></svg>';
这段是我拼接的 用于给canvas 画图的 画出来 原本的img不显示 求助