[Vuejs]-How to use Vue Router programatically with native events?

0👍

It looks like there is one solution that works, but I can’t understand why it works though!

working solution:

<section nativeOnClick={ () => this.$router.push('hello') }></section>

The thing that is confusing is why passing arguments without the handler produces the error by when wrapping with a function it does not.
i.e

<section nativeOnClick={ this.$router.push('hello') }></section> // GIVES error

0👍

Have you tried removing the this reserved word from your jsx native invocation?, for example:

<section nativeOnClick={ navigationPage('login') }></section>

If you can you post the whole script of your single file component (or whatever you are editing) would be helpful for me to be in context.

Leave a comment