【问题标题】:Cannot load Goldenlayout library on electron app无法在电子应用程序上加载 Goldenlayout 库
【发布时间】:2015-11-05 16:48:55
【问题描述】:

嗨,我正在尝试将 Golden Layout 角度复杂应用程序 https://golden-layout.com/tutorials/angular-complex.html 重新创建为电子应用程序,所以基本上我只是做了电子 http://electron.atom.io/docs/latest/tutorial/quick-start/ 的快速入门示例,并在我的 index.html 上完成了黄金布局的所有逻辑但它发送给我这个错误:

作为 GoldenLayout 的依赖项缺少 jQuery。请在 GoldenLayout 的范围(例如窗口)上公开 $ 或在使用 RequireJS/AMD 时将“jquery”添加到您的路径

【问题讨论】:

  • 您是否真的像建议的那样添加了 jquery,并且正如 Golden Layout 的 getting started guide 中建议的第一件事?
  • 是的,我做到了,但这不起作用,看来您可以添加 conf `code node-integration : false 以使其正常工作

标签: javascript jquery angularjs electron


【解决方案1】:

如this answer所示,您需要通过以下方式加载jquery(在包含golden-layout之前):

<script>window.$ = window.jQuery = require('./path/to/jquery.js');</script>

如果我理解正确,问题的发生是因为 jquery '检测'它在 requireJS 环境中运行并在modules 中加载$ 和jQuery(不是window)

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2021-06-30
  • 2015-12-05
  • 1970-01-01
  • 2012-11-17
  • 1970-01-01
  • 2021-06-21
  • 2013-06-07
  • 1970-01-01
相关资源
最近更新 更多