如何在Angular 4项目中实际使用gojs扩展? gojs已被添加到项目中,我在gojs节点模块中看到了扩展。
我的组件中有以下内容:
import * as go from 'gojs';
import TableLayout from '../../node_modules/gojs/extensionsTS/TableLayout';
ngOnInit() {
new TableLayout()
}
但我收到以下构建错误:
ERROR in node_modules/gojs/extensionsTS/TableLayout.ts(414,8):
error TS2403: Subsequent variable declarations must have the same type. Variable 'child' must be of type 'Part', but here has type 'any'.
node_modules/gojs/extensionsTS/TableLayout.ts(445,8):
error TS2403: Subsequent variable declarations must have the same type. Variable 'child' must be of type 'Part', but here has type 'any'.
node_modules/gojs/extensionsTS/TableLayout.ts(542,9):
error TS2403: Subsequent variable declarations must have the same type. Variable 'child' must be of type 'Part', but here has type 'any'.
src/app/app.component.ts(3,8):
error TS1192: Module '"D:/projects/gojs-app1/node_modules/gojs/extensionsTS/TableLayout"' has no default export.
答案 0 :(得分:0)
如果您使用的是 npm
尝试这样做:
npm install gojs -g --save
答案 1 :(得分:0)
尝试使用
从'gojs / extensions / BalloonLink.js'导入{BalloonLink};
请注意,同时存在 /扩展名和 / extensionsTS 路径。
修改
还可以将gojs lib的node_modules复制并粘贴到本地文件夹中,然后作为组件导入。这对我有用。