我正在尝试使用 Bobril 将图像添加到 SVG,但这段代码不起作用:
{
tag: 'svg',
children: {
tag: 'image',
attrs: {
'xlink:href': 'https://raw.githubusercontent.com/Bobris/Bobril/master/logo.png',
x: 0,
y: 0,
width: 200,
height: 200
}
}
}
图像标签添加到页面,但没有显示图像。当我在 Chrome 的 DevTools 中复制元素并再次粘贴时,会显示图像。我究竟做错了什么?
最佳答案
只使用 href 而不是 'xlink:href'。
xlink:href 自 SVG 2 以来已弃用
关于javascript - 如何使用 Bobril 将图像添加到 SVG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42178932/