Today I am facing a problem and I need some advice.
I have a routing page structure, like this {url}/:id. My goal is to prevent the user from navigating to the previous and next page within the same route, for example from {url}/1 to {url}/2. I'm making API calls to change the data on the page and the URL changes accordingly.
However, I want the user to be able to navigate to pages before or after {url}/:id, but not within {url}/:id.
Can you provide any solutions or suggestions? I've heard that navigation guards might be helpful, but I had a hard time understanding them at first.
Thank you in advance for your help!
Sorry, the explanation is not clear. I need the browser to remember that the previous page or next page is another page, like {url}/lists or {url}/news, but not the same routing page, so in After clicking the button on the browser, you will not enter the same routing page...
I find
instead of
Solved my problem.
This is an advanced example using Vue Router: