G6: 使用Plugin:@antv/g6/plugins/layout.dagre自动布局报错: _antv_g6_plugins___WEBPACK_IMPORTED_MODULE_2___default.a.layout-dagre is not a constructor

Created on 26 Dec 2018  ·  1Comment  ·  Source: antvis/G6

g6版本:2.2.5
1,我先import导入g6.
import G6 from '@antv/g6';
2,在导入Plugins
import Plugins from '@antv/g6/plugins/';
3,在实例化
const dagre = new Plugins'layout-dagre';
const graph = new G6.Graph({
container: 'mountNode',
fitView: 'cc',
height: window.innerHeight, // 画布高
plugins: [dagre],
defaultIntersectBox: 'rect' // 使用矩形包围盒
});
但是它报错
ERROR TypeError: _antv_g6_plugins___WEBPACK_IMPORTED_MODULE_2___default.a.layout-dagre is not a constructor

Most helpful comment

我也遇到这样的问题,然后使用以下的方法解决了
import '@antv/g6/build/plugins'
const graph = new G6.Graph({
container: 'mountNode',
plugins: [new G6.Plugins'layout.dagre'],
fitView: 'cc',
height: 500, // 画布高
defaultIntersectBox: 'rect' // 使用矩形包围盒
})

>All comments

我也遇到这样的问题,然后使用以下的方法解决了
import '@antv/g6/build/plugins'
const graph = new G6.Graph({
container: 'mountNode',
plugins: [new G6.Plugins'layout.dagre'],
fitView: 'cc',
height: 500, // 画布高
defaultIntersectBox: 'rect' // 使用矩形包围盒
})

Was this page helpful?
0 / 5 - 0 ratings