首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在GOJS OrgChart中找到图片?

如何在GOJS OrgChart中找到图片?
EN

Stack Overflow用户
提问于 2020-07-08 18:35:57
回答 1查看 215关注 0票数 0

我在代码中使用了gojs orgchart编辑器。

参考资料:https://gojs.net/latest/samples/orgcharteditor.html

我面临三个问题,在角度版本的init函数。

1)在函数init()

代码语言:javascript
复制
    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条件

代码语言:javascript
复制
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中添加了一个接口

代码语言:javascript
复制
interface Window{
 Inspector: any;
}

但不确定,我是否可以在lib.dom.d.ts文件中添加任何内容?

EN

回答 1

Stack Overflow用户

发布于 2020-07-08 21:36:38

如果您使用的是TypeScript,那么您应该使用检查器扩展的TypeScript版本。您可以在https://github.com/NorthwoodsSoftware/GoJS/blob/master/extensionsTS/DataInspector.tshttps://github.com/NorthwoodsSoftware/GoJS/blob/master/extensionsJSM/DataInspector.ts上使用它们,它们基本上都是相同的,而不是一个针对UMD的模块,另一个是针对ES6模块的。

将代码复制到项目中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62801472

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档