vuex直接修改state 與 用dispatch/commit來修改state的差別:

一. 使用vuex修改state時,有兩種方式: 1)能夠直接使用 this.$store.state.變量 = xxx; 2)this.$store.dispatch(actionType, payload) vue     或者:  this.$store.commit(commitType, payload)  vuex    二. 異同點異步   1)共同點: 可以修改state裏的變量,
相關文章
相關標籤/搜索