In strict mode, you can't mutate state directly using v-model
attribute. If you use v-model it throws an error because mutation is not performed inside an explicit Vuex mutation handler.
For example, the below input throws an error due to v-model usage
<input v-model="stateObject.message">
In this case, you need to bind the 's value. It can be resolved using value attribute as below,
<input :value="username" @input="updateProfile">
computed: {
...mapState({
username: state => state.user.username
})
},
methods: {
updateProfile (e) {
this.$store.commit('updateProfile', e.target.value)
}
},
mutations: {
updateProfile (state, username) {
state.user.username = username
}
}