How to get next route after the current route deactivate.?

让人想犯罪 __ 提交于 2019-12-25 07:49:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!