Should we use v-model to modify Vuex store?

前端 未结 5 2065
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 10:50

Hello I am beginner in Vue and I do have a problem that\'s really bugging me. I am wondering should we use v-model directive to modify vuex store? Vuex says that we should modif

5条回答
  •  误落风尘
    2021-02-05 11:17

    Yes you can but is not the best practice.

    As the documentation say the state should be updated only inside mutation to keep the control over the state.

    But if you really want to do it you can with:

    v-model="$store.state.yourProperty"
    

提交回复
热议问题