I am trying to add image to SVG with Bobril, but this code doesn't work:
{
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
}
}
}
Image tag is added to the page, but no image is shown. When I copy the element in Chrome's DevTools and paste it once again, the image is shown. What am I doing wrong?
Instead of 'xlink:href' use just href.
xlink:href is deprecated since SVG 2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.