Backbone.js的Route和History

模拟常规网站的路由和历史记录,方便后退前进

var Workspace = Backbone.Router.extend({
    routes: {
        "help":"help", // #help
        "search/:query":"search", // #search/qqq
        "search/:query/p:page":"search" // #search/qqq/p5
    },
    help: function(){
        alert('1');
    },
    search: function(query, page){
        alert('2');
    }
});

var r = new Workspace;
Backbone.history.start();