我在代码中使用了gojs orgchart编辑器。
参考资料:https://gojs.net/latest/samples/orgcharteditor.html
我面临三个问题,在角度版本的init函数。
1)在函数init()中
mouseDrop: function (e: go.InputEvent, node: go.GraphObject) {
var diagram = node.diagram;
var selnode = diagram.selection.first();
if (mayWorkFor(selnode, node)) {
// find any existing link into the selected node
var link = selnode.findTreeParentLink(); //Getting error: Property 'findTreeParentLink' does not exist on type 'Part'.
if (link !== null) {
link.fromNode = node;
} else {
diagram.toolManager.linkingTool.insertLink(node, node['port'], selnode, selnode['port']);
//Getting error: (parameter) node: go.GraphObject
Argument of type 'GraphObject' is not assignable to parameter of type 'Node'.
Type 'GraphObject' is missing the following properties from type 'Node': invalidateLinkBundle, invalidateConnectedLinks, portSpreading, avoidable, and 170 more.
}
}
}2) init函数中的一个If条件
if (window.Inspector) myInspector = new Inspector("myInspector", myDiagram, //Cannot find name 'myInspector', Cannot find name 'Inspector'
{
properties: {
"key": { readOnly: true },
"comments": {}
}
});3)我在window.Inspector中遇到了一些错误,即'Window & typeof globalThis'上不存在属性‘globalThis’。
所以我在lib.dom.d.ts中添加了一个接口
interface Window{
Inspector: any;
}但不确定,我是否可以在lib.dom.d.ts文件中添加任何内容?
发布于 2020-07-08 21:36:38
如果您使用的是TypeScript,那么您应该使用检查器扩展的TypeScript版本。您可以在https://github.com/NorthwoodsSoftware/GoJS/blob/master/extensionsTS/DataInspector.ts或https://github.com/NorthwoodsSoftware/GoJS/blob/master/extensionsJSM/DataInspector.ts上使用它们,它们基本上都是相同的,而不是一个针对UMD的模块,另一个是针对ES6模块的。
将代码复制到项目中。
https://stackoverflow.com/questions/62801472
复制相似问题