[Vuejs]-Vue | Router navigate to another instance

0👍

If you want to route to /admin page a user after login, you can try this:

@click="navigateToAdmin()"

navigateToAdmin() {
        // if login success
        this.$router.push('/admin'); // automatically routes to admin page
    }

If you going to /admin page manually;

<router-link to="/admin">Admin</router-link>

0👍

You can’t use an unknown route with <router-link> or router.push because the router will fail to resolve it (since that route is not configured in the router).

You should use a regular link

Leave a comment