vue router set path name based on params code example
Example 1: query params vuejs
http://localhost:8000?name=John&[email protected]
parameters = this.$route.query
console.log(parameters)
name = this.$route.query.name
console.log(name)
Example 2: vue router name
<router-link :to="{ name: 'user', params: { userId: 123 }}">User</router-link>
Example 3: vue router name
router.push({ name: 'user', params: { userId: 123 }})