vueX mutation

在mutation中寫上自定義的方法,組件中通過 this.$store.commit(「自定義的方法名」) 就可以更新store中的數據和狀態 直接取值: <div>{{$store.state.count}}</div> 通過methods操作值: addCount(){this.$store.commit('increment')}, 通過methods傳值 addnum(addcounte
相關文章
相關標籤/搜索