获得previous路由器/ URL骨干应用 [英] Get previous router/url in backbone application
本文介绍了获得previous路由器/ URL骨干应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个主干应用程序,我需要知道从哪个当前路由访问路由器。这可能吗?
I have a backbone application and i would require to know the router from which the current route is accessed. Is it possible?
有关如: -
我达到#/电流
从#/测试1
,并在另一个实例,从#/测试1
。
I reach #/current
from #/test1
and also in another instance, from #/test1
.
所以,我可以知道通过一些方法来检测previous路由器命中?
So can i know through some way to detect the previous router hit?
香港专业教育学院使用的:
Ive used :
Backbone.history.fragment
和这只是给了我访问的,而不是从该航线目前的路线。
and this only gives me the current route accessed and not from which route.
推荐答案
您可以存储你的历史在某些阵列,并做一些处理与去年/ previous项目。
You can store your history in some array and do some manipulation with last/previous items.
var history = [];
this.listenTo(this, 'route', function (name, args) {
history.push({
name : name,
args : args,
fragment : Backbone.history.fragment
});
console.log(history);
});
这篇关于获得previous路由器/ URL骨干应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文