javascript - Vue router clear history API when going back from a default view? - Stack Overflow

I am using the vue-router for overlay menu's on mobile. This means when a user selects a filter li

I am using the vue-router for overlay menu's on mobile. This means when a user selects a filter link a full overlay will slide in from the left with filters options.

A user can of course select a filter from the default view, go back to the default view and select a filter again. This will cause the history to contain:

  • Default view
  • Filter view
  • Default view
  • Filter view

When a user clicks back multiple times it will iterate through the actions in reverse while preferably if there is an overlay active it should go back to the default view and then simply omit the history API data and continue with the default history data.

To get this done I guess I could use named routes and differentiate from a root(default) route between a non-root(overlay). If I want to go back on a root I should then delete the history API data?

Any thoughts on how to get this done?

The browser history can not be manipulated so how do I go back to a state before all the manipulation that has been done by the vue-router?

I am using the vue-router for overlay menu's on mobile. This means when a user selects a filter link a full overlay will slide in from the left with filters options.

A user can of course select a filter from the default view, go back to the default view and select a filter again. This will cause the history to contain:

  • Default view
  • Filter view
  • Default view
  • Filter view

When a user clicks back multiple times it will iterate through the actions in reverse while preferably if there is an overlay active it should go back to the default view and then simply omit the history API data and continue with the default history data.

To get this done I guess I could use named routes and differentiate from a root(default) route between a non-root(overlay). If I want to go back on a root I should then delete the history API data?

Any thoughts on how to get this done?

The browser history can not be manipulated so how do I go back to a state before all the manipulation that has been done by the vue-router?

Share Improve this question asked Dec 4, 2017 at 13:49 Stephan-vStephan-v 20.4k32 gold badges121 silver badges210 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Try navigating around the filter views by calling this.$router.replace(). That way, back will take you to the page before default.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742396253a4436004.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信