[Vuejs]-How can I use VueJS to navigate to another page/URL?

0👍

Use router.push('url') (remove the this.). You haven’t declared router in your data(), so it wouldn’t be set on this. It’s just a local variable.

0👍

in your code:
this.router
should be
this.$router

You need to define your router with path => component

const routes = [
    { path: '/foo', component: Foo },
    { path: '/bar', component: Bar }
]

If you would like to redirect user to another site, you may work with location object directly without router

// Sets the new location of the current window.
window.location = "https://www.example.com";

Leave a comment