[Vuejs]-Vue – Is it possible to use Vuex getters in the computed property of a component?

1👍

navLinks should be a function that returns an array :

computed: {
  ...mapGetters(['user', 'loggedIn']),
  navLinks(){
  return [
    {
      vif: !this.loggedIn,
      name: 'Register',
      text: 'Registrieren',
    },
    {
      vif: this.loggedIn,
      name: 'Logout',
      text: 'Logout',
    },
  ];
 ),
},

Leave a comment