我用路由器设置了我的第一个小主干应用程序,看看我是否可以触发一些动作。我不能。我没有收到错误消息,但没有显示 console.log 消息。我还需要设置什么才能启动应用程序吗?
window.BreakfastApp = new (Backbone.Router.extend({
routes: { "": "interest", "products/:type": "products"},
initialize: function(){
console.log("hello world");
},
start: function(){
Backbone.history.start({pushState: true});
},
interest: function(){
console.log('interest')
},
products: function(type){
console.log('product' + type )
},
toppings: function(){
console.log('toppings')
},
results: function(){
console.log('results')
}
}));
$(function(){
BreakfastApp.start();
});