简体   繁体   English

未捕获的TypeError:尝试读取JointJS Hello World示例时,无法读取未定义的属性“ push”

[英]Uncaught TypeError: Cannot read property 'push' of undefined - when trying to JointJS Hello World example

I'm trying to get the JointJS 'Hello World' example to work 我正在尝试让JointJS“ Hello World”示例起作用

Reference: https://resources.jointjs.com/tutorial/hello-world 参考: https : //resources.jointjs.com/tutorial/hello-world

The dependencies are all loaded in the correct order but I can't get around the following exception: Uncaught TypeError: Cannot read property 'push' of undefined when trying to run the example. 所有依赖项都以正确的顺序加载,但是我Uncaught TypeError: Cannot read property 'push' of undefined以下异常: Uncaught TypeError: Cannot read property 'push' of undefined尝试运行示例时, Uncaught TypeError: Cannot read property 'push' of undefined

I realize that Backbone requires underscore but I read in a different article that Backbone 1.3.3 should be compatible with Lodash. 我意识到Backbone需要下划线,但是我在另一篇文章中读到Backbone 1.3.3应该与Lodash兼容。 When I do include underscore it seems to conflict with lodash (which jointjs requires). 当我添加下划线时,似乎与lodash(jointjs要求)冲突。 eg. 例如。 '_.create is not defined'. “ _.create未定义”。

I've tried a multitude of different versions to no avail. 我尝试了许多不同的版本都没有用。

Here's a jsfiddle where I'm trying to get it to work in. 这是一个jsfiddle,我正在尝试使其运行。

https://jsfiddle.net/0mdg8xja/1/ https://jsfiddle.net/0mdg8xja/1/

What am I doing wrong and how can I get around this exception in this scenario? 我在做什么错?在这种情况下如何解决此异常?

I came to the idea of looking up existing JSFiddles and stumbled upon this one: 我想到了查找现有的JSFiddles的想法,偶然发现了这一点:

https://jsfiddle.net/robertrozas/gfaL9ype/ https://jsfiddle.net/robertrozas/gfaL9ype/

I compared the hello world example to this one and it appears that the only thing I was missing was the fact that I had to wrap the javascript inside: 我将hello world示例与此示例进行了比较,似乎我所缺少的唯一一件事就是必须将javascript包装在其中:

$(function(){ });

This seems to work regardless of what versions I use. 无论我使用什么版本,这似乎都可以工作。 I tested it on JointJS 0.9.7 and 1.1.0 , backbone 1.1 , 1.3.3 and lodash 3.10.1 . 我测试JointJS 0.9.71.1.0 ,骨干1.11.3.3和lodash 3.10.1

Here's the updated JSFiddle for if anyone stumbled upon the same foreheadsmacker as I did. 如果有人像我一样偶然碰到了相同的额头,这就是更新的JSFiddle。

https://jsfiddle.net/gfaL9ype/30/ https://jsfiddle.net/gfaL9ype/30/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的类型错误:尝试显示数据时无法读取未定义的属性“0” - Uncaught TypeError: Cannot read property '0' of undefined when trying to display data 加载FullCalendar> Uncaught TypeError:无法读取未定义的属性'push' - FullCalendar on loading > Uncaught TypeError: Cannot read property 'push' of undefined 偶尔收到“未捕获的TypeError:无法读取未定义的属性'push'” - Getting “Uncaught TypeError: Cannot read property 'push' of undefined” sporadically 未捕获的类型错误:无法读取 Vuejs 中未定义的属性“推送” - Uncaught TypeError: Cannot read property 'push' of undefined in Vuejs 流星未捕获TypeError:无法读取未定义的属性“ push” - Meteor Uncaught TypeError: Cannot read property 'push' of undefined 捕获TypeError:无法读取未定义的属性“ push” - Getting Uncaught TypeError: Cannot read property 'push' of undefined 数组:未捕获的类型错误:无法读取未定义的属性“推送” - Array: Uncaught TypeError: Cannot read property 'push' of undefined Javascript Uncaught TypeError:无法读取未定义的属性“推送” - Javascript Uncaught TypeError: Cannot read property 'push' of undefined 变量问题:未捕获的TypeError:无法读取未定义的属性“推” - variable problem: Uncaught TypeError: Cannot read property 'push' of undefined “未捕获的TypeError:在尝试从对象获取属性时无法读取未定义的属性'x' - “Uncaught TypeError: Cannot read property 'x' of undefined” when trying to get a property from an object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM