【问题标题】:RequireJS does not work with jQuery MobileRequireJS 不适用于 jQuery Mobile
【发布时间】:2013-07-07 11:33:46
【问题描述】:

我应该如何在我的项目中包含 jquery.mobile.js 以便我可以将它与 RequireJS 一起使用。

当我在我的项目中添加 jquery.mobile.js 时,我开始收到以下错误。

未捕获的错误:不匹配的匿名 define() 模块:函数 ($) {
工厂($,根,文档);
返回 $.mobile;
}

我也关注了这篇文章。 Separating jQuery Mobile (1.1.0) from AMD (RequireJS)

【问题讨论】:

    标签: jquery-mobile requirejs


    【解决方案1】:

    这是working example。它包括 Requirejs、jQueryMobile、Backbone 和 Marinonette。

    index.html文件中,需要指定requirejs加载的主模块。

    <script type="text/javascript" data-main="js/main" src="js/libs/require-2.1.2.min.js"></script>
    

    在这个例子中,主模块在"js/main.js"

    在 main.js 中,您指定 require.config 并使用 define 来加载您的模块。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-07
      • 1970-01-01
      • 2013-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多