Backbone.js的回退中的散列后斜线 - 历史pushState的 [英] Backbone.js slash after hash in fallback - history pushState
本文介绍了Backbone.js的回退中的散列后斜线 - 历史pushState的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 Backbone.js的的路由。
它产生这样的浏览器的网址:
http://my-app.com/help
有关互联网探索者(除了IE10)和旧的非HTML5的浏览器:
http://my-app.com/#help
如何Backbone.js的配置产生额外的斜线的URL后备,是这样的:
http://my-app.com/#/help
解决方案
我相信,你的第二code座比3完全不同。在preceding斜线上设置属性名。
路线:{
帮助:帮助,//#帮助
搜索/:查询:搜索,//#搜索/猕猴桃
搜索/:查询/ P:页面:搜索//#搜索/猕猴桃/ P7
}
不同于
路线:{
/帮助:帮助,//#/帮助
/搜索/:查询:搜索,//#/搜索/猕猴桃
/搜索/:查询/ P:页面:搜索//#/搜索/猕猴桃/ P7
}
I'm using Backbone.js's routing. It generate urls for browsers like this:
http://my-app.com/help
For Internet Explorers (except IE10) and old non-HTML5 browsers:
http://my-app.com/#help
How to configure Backbone.js to generate fallback urls with additional slash, like this?:
http://my-app.com/#/help
解决方案
I do believe that your 2nd code block is entirely different than the 3rd. The preceding slash is set on the property name.
routes: {
"help": "help", // #help
"search/:query": "search", // #search/kiwis
"search/:query/p:page": "search" // #search/kiwis/p7
}
is different than:
routes: {
"/help": "help", // #/help
"/search/:query": "search", // #/search/kiwis
"/search/:query/p:page": "search" // #/search/kiwis/p7
}
这篇关于Backbone.js的回退中的散列后斜线 - 历史pushState的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文