[Vuejs]-How to dynamically tab changes in vue js 2 by selected props?

0👍

look this version with vuex

seletedTab is a getters, use it anywhere in the app.
Vue Js code:

<script>
import TabParentComponent from 
'../../components/layout/tabParentComponent.vue'
import TabChildComponent from 
'../../components/layout/tabChildComponent.vue'

import { mapGetters, mapActions } from 'vuex'

export default {
  components: {
  'tab': TabChildComponent,
  'tabs': TabParentComponent
},
computed: {...mapGetters([
  'selectedTab'
  ])
},
methods: {
  ...mapActions([
    'GoTab'
  ])
 }
}
</script>

Do not forget that the structure of the application with vuex will be slightly different! See Application Structure

Leave a comment