[Vuejs]-Vue router unexpected redirection

0๐Ÿ‘

โœ…

I was getting this error because I was using an <a> tag.

<li><a href="#" @click="logout()">Logout</a></li>

So it was going to # url(which led to the fallback route) instead of invoking the @click.
Hence I had to use the @click.prevent to prevent this default behavior of anchor tag:

<li><a href="#" @click.prevent="logout()">Logout</a></li>

0๐Ÿ‘

Your Problem is

router.go

the go method accepts an integer as parameter ( see http://router.vuejs.org/en/essentials/navigation.html )

I think you actually want a

router.push({ path: "/login"})

Leave a comment