Vue.js 3, vue-router, @click event reloads whole page

Add prevent modifier as you did then inside the toggleMenu add this.$router.push("/"); :

 <router-link to="/" @click.prevent="toggleMenu">
    <div class="nav-item">Home</div>
  </router-link>

LIVE DEMO

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top