我一直在尝试从http://net.tutsplus.com/tutorials/javascript-ajax/building-a-scalable-app-with-backbone-js/扩展模板应用程序。通过以下实现,我面临“未捕获的 ReferenceError:未定义 jQuery”。有人可以让我知道可能是什么问题导致它。
config.js
// Set the require.js configuration for your application.
require.config({
// Initialize the application with the main application file
deps: ["main"],
urlArgs: "bust=" + (new Date()).getTime(),
waitSeconds: 15,
paths: {
// JavaScript folders
libs: "../assets/js/libs",
plugins: "../assets/js/plugins",
// Libraries
//jquery: "../assets/js/libs/jquery",
jquery: "http://code.jquery.com/jquery-1.7.min",
jquerycookie: "../assets/js/libs/jquery.cookie",
jqueryDataTables: "../assets/js/libs/jquery.dataTables.min",
jqueryValidate: "../assets/js/libs/jquery.validate",
jqueryValidateUnobtrusive: "../assets/js/libs/jquery.validate.unobtrusive",
underscore: "../assets/js/libs/underscore",
backbone: "../assets/js/libs/backbone",
highcharts: "../assets/js/libs/highcharts/highcharts",
highstock: "../assets/js/libs/highcharts/highstock",
easyXDM: "../assets/js/libs/easyXDM/easyXDM.min",
dateFormat: "../assets/js/libs/date.format",
// Shim Plugin
use: "../assets/js/plugins/use"
},
priority: [
'jquery',
'jquerycookie',
'jqueryValidate',
'jqueryValidateUnobtrusive',
'underscore',
'easyXDM',
"highcharts",
"highstock",
"dateFormat"
],
use: {
backbone: {
deps: ["use!underscore", "jquery"],
attach: "Backbone"
},
jqueryDataTables: {
deps: ["jquery"]
},
jqueryValidate: {
deps: ["jquery"]
},
jqueryValidateUnobtrusive: {
deps: ["jquery", "jqueryValidate"]
},
jquerycookie: {
deps: ["jquery"]
},
underscore: {
attach: "_"
},
highcharts: {
exports: 'Highcharts'
},
highstock: {
exports: 'highstock'
}
}
});
main.js
require([
"namespace",
// Libs
"jquery",
"jqueryDataTables",
"use!backbone",
'jquerycookie',
'jqueryValidate',
'jqueryValidateUnobtrusive',
'highcharts',
// Modules
"modules/tricklebot",
"modules/home",
"modules/dashboard",
"modules/profile",
"modules/transactions",
"modules/analysis",
"modules/signup",
],
function(namespace, $, jqDT, Backbone,
jqCookie, jqValidate, jqValidateUnobtrusive, highcharts,
tricklebot, Home, Dashboard, Profile, Transactions, Analysis, Signup) {
......
......