antv-x6 在ie11报错

cenggel
  • 30

整体代码如下

<div id="container" style="height:100%; width: 100%;"></div>
<script src="https://unpkg.com/@antv/x6/dist/x6.js"></script>
<script type="text/javascript">
    var data = {
        nodes: [
            {id: 'node1', x: 40, y: 40, width: 80, height: 40, label: 'Hello',},
            {id: 'node2', x: 160, y: 180, width: 80, height: 40, label: 'World',},
        ],
        edges: [
            {source: 'node1', target: 'node2',},
        ]
    }
    console.log(X6.Graph)
    var graph = new X6.Graph({
        container: document.getElementById('container'),
        width: 800,
        height: 600,
    });
    graph.fromJSON(data)
</script>

报错信息:
image.png

console.log(X6.Graph)  出来的是 undefined

官方文档说可以支持IE11

回复
阅读 793
1 个回答
<script src="https://cdn.bootcdn.net/ajax/libs/babel-polyfill/7.12.1/polyfill.js"></script>

X6之前加入polyfill吧。

你知道吗?

宣传栏