【问题标题】:Latest require.js Not Working with the Latest jQuery Mobile and knockout.js最新的 require.js 不适用于最新的 jQuery Mobile 和 knockout.js
【发布时间】:2012-11-01 01:56:15
【问题描述】:

我有一个使用 require.js v2.0.4、knockout.js v2.2.0 的 ASP.NET Web API 单页应用程序(所有 HTML5/CSS3/JavaScript 都与 Web API 对话以传输 JSON 数据),和 jQuery Mobile v1.2.0。使用 Nuget,我升级到了最新版本的 require.js (v2.1.1)。 (注意:我只使用了 require.js。我删除了 r.js。过去我从来不需要它,那是一天前。)而且,现在我的应用程序无法正常工作。

在浏览器工具的“网络”选项卡上,我可以看到正在以正确的顺序下载脚本(即 jquery、jquery.mobile、其他脚本,包括 knockout.js,然后是 require.js)。但是,在错误控制台上,我看到以下错误:

require.js line 1746
Error: Mismatched anonymous define() module: function ($) {
            factory( $, root, doc );
            return $.mobile;
        }

require.js line 1746
Mismatched anonymous define() module: function (koExports) {
// Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler).
// In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable.
var ko = typeof koExports !== 'undefined' ? koExports : {};
(a lot more error message here – left out for brevity)

是否存在与最新版本的 require.js、knockout.js 和 jQuery Mobile 的兼容性问题? 有没有其他人对同样的东西有问题/错误? 如何让所有这些 3rd 方 JavaScript 库协同工作?

谢谢。

【问题讨论】:

    标签: jquery jquery-mobile knockout.js requirejs


    【解决方案1】:

    我相信我成功了。我放错了页面和内容的数据属性(jQuery Mobile 的东西)。我也不知道为什么我也遇到了淘汰赛错误。但是,哦,好吧。现在我开始讨论下一个问题——让 sammy.js(仅用于基于哈希的导航)和 jQuery Mobile 一起很好地发挥作用(如果它甚至可能的话......)。 谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-24
      • 2011-04-30
      相关资源
      最近更新 更多