Path cannot be used with params in this. $router. Push() method, otherwise params will be invalid

Path in this. $router. Push() method cannot be used with params, otherwise params will be invalid!!

This. $router.push can pass parameters in two ways:

The first one is the first one

Pass parameters -- this.$router.push({path: ' route ', query: {key: value}})

Parameter fetch -- this.$route.query.key

With this approach, the passed parameters are spliced after the route and appear in the address bar.

Second:

Passing parameters -- this.$router.push({name: ' name of route ', params: {key: value}})

Parameters take values -- this.$route.params.key

With this approach, the parameters are not spliced behind the route and are not visible on the address bar...

Dynamic routing also passes params, so in this. $router. Push() method, path cannot be used with params, otherwise params will be invalid. You need name to specify the page.

[access through the name attribute of routing configuration]


Read More: