[Vuejs]-How can I pass an object in params when using $router.push()?

1👍

router.push and router-link are meant to do the same thing which is to redirect you to a new location/address, for example, /artists/1 (they are just doing it in a different way, dynamically vs statically). So in principle, it is the responsibility of that component to find the related data for this address, not the requester. In your case, it is the responsibility of the Artist.vue to find the data with the given artist Id, or artist route. In reality, you should have some method in this component to either fetch data from a local data store, e.g. using a vuex store or just plain js (put the artist list into a artist.js and reuse that in both Artists.vue, Artist.vue), or from a server using ajax.

Leave a comment