2
main.js定義呼叫:未捕獲的錯誤:沒有爲pnotify
requirejs.config({
enforceDefine: true,
paths: {
"jquery": "libs/jquery/jquery-min",
"underscore": "libs/underscore/underscore-min",
"backbone": "libs/backbone/backbone-min",
"jquery.pnotify":"libs/jquery/jquery.pnotify.min"
},
shim: {
"underscore": {
deps: [],
exports: "_"
},
"backbone": {
deps: ["jquery", "underscore"],
exports: "Backbone"
},
"jquery.pnotify" : {
deps : ["jquery"],
exports : "jQuery.fn.pnotify"
}
}
});
查看:
define(["jquery" ,
"underscore" ,
"backbone" ,
"jquery.pnotify",
"models/CartModel" ,
],function($ , _ , Backbone , Cart){
var CartView = Backbone.View.extend({
initialize: function() {
this.updateQtyLabel("qtyCart");
},
el: '.addToCart-form',
events : {
"click #addToCart" : "addToCart"
},
addToCart : function(){
$.pnotify({
title: 'Go to Cart and Check Out',
text: '1 item added to Cart',
shadow:false,
delay:1000
});
},
render: function(){
}
});
return CartView;
});
我得到一個錯誤Uncaught Error: No define call for jquery.pnotify
。
任何幫助,非常感謝。
你在頁面中包含了'pnotify'插件的javascript嗎? –
@RoryMcCrossan:使用require.js不需要在頁面中包含JavaScript源代碼,對吧? – Nothing