【问题标题】:Jquery no Conflict with require js issueJquery与require js问题没有冲突
【发布时间】:2013-07-11 21:34:08
【问题描述】:

我定义了这里定义的 jquery 无冲突方法Using private jquery with RequireJS - issue after optimisation

但在此之后,我会使用这些额外的配置加载我的页面。

config.paths.jqueryLayout = ["scripts/jquery.layout-1.3.0"];
config.shim.jqueryLayout = {deps: ['jquery']};

config.paths.jqueryUi = ["scripts/jquery-ui-1.10.min"];
config.shim.jqueryUi = {deps: ['jquery']};

现在在将无冲突添加到 true 之后..我得到了所有这些错误,如下所示,不知道为什么?请问有人可以帮忙吗?

Uncaught TypeError: Cannot read property 'ui' of undefined jquery-ui-1.10.min.js:5
Uncaught TypeError: Cannot read property 'fn' of undefined 
Uncaught TypeError: Cannot read property 'fn' of undefined jquery.event.drag-2.0.min.js:6
Uncaught TypeError: undefined is not a function bootstrap.min.js:6
Uncaught TypeError: Cannot call method 'extend' of undefined slick.pager.js:146
Uncaught TypeError: Cannot call method 'extend' of undefined slick.core.js:9
Uncaught TypeError: undefined is not a function highcharts.js:30
Uncaught TypeError: Cannot call method 'extend' of undefined slick.cellselectionmodel.js:3
Uncaught TypeError: Cannot read property 'CellSelectionModel' of undefined 

谢谢

【问题讨论】:

    标签: jquery angularjs requirejs


    【解决方案1】:

    与该问题相关的方法:Mapping Modules to use noConflict,这样说:

    如果您的所有模块(包括任何第三方 jQuery 插件或依赖于 jQuery 的库代码)都与 AMD 兼容并且您想避免...

    但您似乎使用了几个与 AMD 不兼容的 jQuery 插件(即您需要 shim 配置),所以我认为您无法使用 noConflict 方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-29
      • 2015-03-13
      • 2011-08-12
      • 2016-06-27
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多