0๐
- Install https://github.com/vuejs/vuex-router-sync . It will give you your current route state in your Vuex.
- In your
<sidebar-component>
just refer tothis.$store.state.route.name
(or path, or whatever you need) and use it in yourv-if
or somewatch
.
This is the easiest and most scalable solution to handle changes in components based on current route in application.
Hope it helps.
Source:stackexchange.com