1

我是and的新手backbone.jsrequire.js还不清楚怎么用require.js。现在我正在尝试使用require.jswith Jquery Reveal

这是我的main.js

requirejs.config({
     enforceDefine: true,
     paths: {
    "jquery": "libs/jquery/jquery-min",
    "underscore": "libs/underscore/underscore-min",
    "backbone": "libs/backbone/backbone-min",
    "jquery.reveal":"libs/jquery/jquery.reveal"

    },
   shim: {
    "underscore": {
        deps: [],
        exports: "_"
    },
    "backbone": {
        deps: ["jquery", "underscore"],
        exports: "Backbone"
    },
    "jquery.reveal": ["jquery"]
   }
});
define(["jquery", "underscore", "backbone","jquery.reveal"],
  function ($, _, Backbone,Jquery_Reveal) {
    console.log("reveal " + typeof Jquery_Reveal);

  }
);

应用程序.js:

define([
'jquery',
'underscore',
'backbone',
'router',
'jquery.reveal'

 ], function($, _, Backbone,Router,Reveal){

    var initialize = function(){
    Router.initialize();
 };

return {
    initialize: initialize
};

});

然后我在 chrome 控制台中遇到错误:Uncaught Error: No define call for reveal

4

1 回答 1

0

这是我发现的,它对我有用:

"reveal": {
   deps: ["jquery"],
   exports: "jQuery.fn.reveal"
}
于 2013-09-27T08:31:21.687 回答