0๐
If you have single Vue
instance for your routes, you can use this.$router.push({ name: 'component' })
:
methods: {
check() {
if( this.email == 'admin' && this.password == 'admin'){
this.$router.push({ name: 'dashboard' });
//OR with relative path
this.$router.push({ path: '/dashboard' });
}
}
...
0๐
If you want you can easily to do that with this:
check() {
if( this.email == 'admin' && this.password == 'admin'){
window.location = "/dashboard"
}
}
Source:stackexchange.com