vue router dorongan
//Syntax - this.$router.push(path);
this.$router.push("/path");
iamhanumanth
//Syntax - this.$router.push(path);
this.$router.push("/path");
const userId = '123'
router.push({ name: 'user', params: { userId } }) // -> /user/123
router.push({ path: `/user/${userId}` }) // -> /user/123
// This will NOT work
router.push({ path: '/user', params: { userId } }) // -> /user
// literal string path
router.push('home')
// object
router.push({ path: 'home' })
// named route
router.push({ name: 'user', params: { userId: '123' } })
// with query, resulting in /register?plan=private
router.push({ path: 'register', query: { plan: 'private' } })
//routes.js
{
name:"routeName",
path: "/RourteUrl/:id",
...
//when creating a route make sure you add a name:"route name" to your declaration
//other wise you cant use router.push({name:"route name",params:{}})
//the name must be identified in routes.js to let vue router use the name and
//build the url
//in your code
router.push({ name: 'routeName', params: { id: 'your id' } })