0
我想要做的就是使用webpack将import
与多个外部svg
图像进行加载,然后将它们附加到使用d3的组中。我目前使用d3的.html
方法来做到这一点,但它在IE11及以下版本中不起作用。在IE11中使用d3和Webpack添加外部svg
下面是它是如何建立现在:
import aerosolsImage from '../../images/topic-aerosols.svg'
import cloudsImage from '../../images/topic-clouds.svg'
import fireImage from '../../images/topic-fire.svg'
const topicsToImages = {
'aerosols': aerosolsImage,
'clouds': cloudsImage,
'fire': fireImage
}
...
// called every few seconds to trigger new animation
function start (topic, animationLayer) {
const g = animationLayer.append('g')
...
g.append('g')
.html(topicsToImages[topic]);
}
加载与的WebPack的SVG返回一个像这样的字符串:
"<svg xmlns="http://www.w3.org/2000/svg">...</svg>"
有另一种方式来追加使用D3,在IE工程的SVGs ?打开想法,谢谢!