Answers for "why routerlink redirect to another page in vue"

13

button click redirection to another page vue

<button @click="goToHome()"> </button>

//inside the script section, define the function:
 methods:{
   goToHome(){
   this.$router.push('/home'); 
      }
  }

//if the route accepts params, you can also use
this.$router.push({name:'home', params: {id: '[paramdata]'}});
Posted by: Guest on October-31-2020
6

vue redirect to route

// Use this in a lifecycle method
this.$router.push('/login');
Posted by: Guest on July-20-2020

Code answers related to "why routerlink redirect to another page in vue"

Code answers related to "Javascript"

Browse Popular Code Answers by Language