[Vuejs]-Haw can I add variable(value from getter) in router-link path in vue.js (with typescript)?

0👍

set the router path correctly with a parameter:

  {
   path: '/:languageParameter/summary',
   name: 'About',
   ....
  }

in your computed get the getter value into the component:

import { mapGetters } from 'vuex';

@Component({
  computed:{
    ...mapGetters(['getlang'])
  }
})

then bind the value of getter from computed into your router-link:

<router-link :to="`${getlang}/summary`">
     <button type="button" @click='questionsFinish' class="btn btn-primary" 
            :disabled="!isFinishStepEnabled">{{$lang.message.solution_calculate}}
     </button>
 </router-link>

Leave a comment