问题
I have some code that uses route 'deactivate' method as follows.
deactivate: function() {
this._super();
//some code here
}
Is there a way to identify where is user trying to go(route of URL) after this route deactivates?
回答1:
I would encourage you to use willTransition
actions method hook for this purpose since that will be called before deactivate
hook method.
transition.targetName
will provide the target route.
actions: {
willTransition(transition) {
this._super(...arguments);
console.log('willTransition user ', transition.targetName);
}
}
来源:https://stackoverflow.com/questions/41542910/how-to-get-next-route-after-the-current-route-deactivate