vuex是vue的状态管理工具
state 存放状态
mutations 唯一可以修改state数据
getters vuex的计算属性
actions 异步操作 需要经过mutations内的方法改变state
modules 模块化
获取state this.$store.state.
获取mutations this.$store.commit
获取actions this.$store.dispatch
语法糖 需要先引入 映射关系
import {mapState,mapMutations,mapGetters,mapActions} from "vuex"
...mapState ...mapGetters 是在computed中
...mapMutations ...mapActions 在methods中