网友回复
很简单
var mySvg = document.querySelector(".mysvg");
var svgCon = mySvg.outerHTML;
//svg转base64;
alert(window.btoa(unescape(encodeURIComponent(svgCon))));
完整代码如下:
<!DOCTYPE html>
<html>
<head>
<title>svgAsHtml</title>
<meta charset="utf-8">
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/d3.js"></script>
</head>
<body>
<svg width="300" height="170" class="mysvg" viewbox="0 0 300 170" xmlns="http://www.w3.org/2000/svg" version="1.1">
<path d="M100 10 L50 60 L150 60 Z" stroke="#FB716D" stroke-width="3" fill="#FBA28A" />
<rect x="55" y="61" width="90" height="100" fill="#F3C392"></rect>
<rect x="85" y="97" width="30" height="30" stroke="#f6f6f6" stroke-width="3" fill="#B2DBCB" />
<line x1="85" x2="115" y1="112" y2="112" stroke="#f6f6f6" stroke-width="3" fill="transparent" />
<line x1="100" x2="100" y1="97" y2="127" stroke="#f6f6f6" stroke-width="3" fill="transparent" />
<g transform="translate(150,-18)">
<path d="M 30 160 A 30 35, 0, 1, 1, 60 160 L 45 160 Z" fill="#7ACB9E"></path>
<rect x="40" y="160" width="10" height="22" fill="#EBBEA6" />
</g>
<g transform="translate(187,-18)">
<path d="M70 100 L40 160 L100 160 Z" fill="#7ACB9E" />
<rect x="65" y="160" width="10" height="22" fill="#EBBEA6" />
</g>
</svg>
<script type=...点击查看剩余70%
有没有让本地开源大模型越狱的方法或插件啥的?
如何使用Zero Trust的Tunnels技术将局域网电脑web服务可以公网访问呢?
编程领域ai大模型的排名是怎么样的?
如何修改别人发给我的微信笔记内容?
fbx、obj、glb三维格式模型如何在浏览器中通过three相互转换格式?
python如何实现基于http隧道加密的正向代理服务?
有没有有专门针对 UI 界面截图进行智能标记(Set-of-Mark, SoM) 的开源库和工具?
如何用python实现Set-of-Mark (SoM) 技术?
python如何截取windows指定应用的窗口截图,不用管窗口是不是在最前面?
linux能不能给rm删除命令增加回收站功能,可恢复被删文件?


