[Vuejs]-Modify sidebar component based on content section component in Vue

0๐Ÿ‘

  1. Install https://github.com/vuejs/vuex-router-sync . It will give you your current route state in your Vuex.
  2. In your <sidebar-component> just refer to this.$store.state.route.name (or path, or whatever you need) and use it in your v-if or some watch .

This is the easiest and most scalable solution to handle changes in components based on current route in application.

Hope it helps.

Leave a comment