vuejs / router

🚦 The official router for Vue.js
https://router.vuejs.org/
MIT License
3.88k stars 1.18k forks source link

Ability to check if a router has any pages to go back/forward to #2177

Closed Bertie2011 closed 6 months ago

Bertie2011 commented 6 months ago

What problem is this solving

I'm building an app where routers (and their views) are placed within virtual windows within the app. The windows have their own back/forwards buttons and it seems that I have no way of knowing if there are any pages to go back or forwards to.

Proposed solution

Describe alternatives you've considered

I looked in the API docs and couldn't find any useful methods/fields on the router/history.

posva commented 6 months ago

This has been requested before. There is no native api to check for that but you can write to history.state after each navigation to create the behavior you want