主.js:
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
。
任何帮助深表感谢。