vue js redirect to a different site code example
Example 1: 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]'}});
Example 2: vue redirect to route
// Use this in a lifecycle method
this.$router.push('/login');