[Vuejs]-Passing data between paths using $router.push() in VueJS

0👍

You can use a query to pass the role.

So add a query where you programmatically navigate the user to homepage:

this.$router.push({path:'/', query:{role: this.role}});

Then in your home page component you can retrieve the route queries for your functionality

For example:

//homme page component

created(){
  if(this.$route.query.role === 'admmin){
    //this is admin
  }
}

Leave a comment