0
votes

I get bellow error in my browser.

Computed property "username" was assigned to but it has no setter.

in my computed code is bellow:

  username:{
    get(){return this.$store.state.user_data.username}
  },

you see I get the username by this.$store.state.user_data.username.

so I do not have a set_username in mutations for commit, so there I do not give a set(){}.

How to avoid this issue?

1

1 Answers

0
votes

The default computed properties is getter only (document). You can change to:

computed: {
  username () {
    return this.$store.state.user_data.username
  }
}

You might want to use mapState helper of vuex