Vue.js – Vuejs: Event on route change


In my main page I have dropdowns that show v-show=show by clicking on link @click = "show=!show" and I want to set show=false when I change route. Advise me please how to realize this thing.

Best Solution

Setup a watcher on the $route in your component like this:

    $route (to, from){ = false;

This observes for route changes and when changed ,sets show to false