[Vuejs]-How do I update my data based on the query parameter in vue-router

0👍

There is no path or name value here to actually initiate a change to the page route. If you want to simply reload the existing page with a new set of query parameters see this information from the documentation:

Note: If the destination is the same as the current route and only params are changing (e.g. going from one profile to another /users/1 -> /users/2), you will have to use beforeRouteUpdate to react to changes (e.g. fetching the user information).

In your comments you mentioned that you are making a request to a server. It’s hard to give a full answer without more code from your application but query parameters might not be the most straightforward way to approach your problem. You should explore setting up a fetch request in your method or using axios to interact with the server (assuming you’re communicating via an API) to build a more reliable and better scaling communication pattern.

Leave a comment