我在使用骨干网路由我的网页时遇到了问题。
#
和/
pushState : true
替换为root:giving the actual parent root
Backbone.history.navigate('xyz',true)
。localhost:8080/abc/login?sid=123
这样的网址,而不是此localhost:8080/abc/index.html#login?sid=123
路由器:
define([ 'jquery', 'underscore', 'backbone' ], function($, _, Backbone) {
var AppRouter = Backbone.Router.extend({
lView: function (route, name, path) {
var self = this;
self.route(route, name, function () {
require([path], function (module) {
var view = new module(name);
view.render();
});
});
}
});
var App = {
ROOT: "/abc/",
router : new AppRouter()
};
var initialize = function(){
var app_router = new AppRouter();
app_router.lView('*actions', 'login', 'loginView');
Backbone.history.start({
root: App.ROOT,
pushState: true
});
};
return {
initialize: initialize
};
});