1

I'm using backbonejs w/ routes and I'd like to know when a person has clicked on the same route that they are already on.

For example, if they are on /#/home, then they click a link again for the same route. I tried to bind all, but it only seems to register if a route is actually changed.

Thanks!

4

1 回答 1

0

我不知道您要达到什么目标,但以下内容可能会有所帮助:

Backbone.history.on('all', function (name, e, route) {
    if(route === lastroute) {
        refresh();
    }
}

Backbone.history.navigate('home', {trigger: true})如果您使用这种导航,请务必使用。

于 2012-10-10T15:12:52.380 回答