vuex


vuex
state:全局状态 this.$store.state.A
getter:计算属性 this.$store.getters.A
mutations:修改数据方法 this.$store.commit(A,参数)
actions:异步修改数据 this.dispatch("A")
modules:vuex模块细分 import引用模块,通过模块名添加
模块
使用:state:解构模块名 =>模块名+变量名
mumutations:直接解构,再调用
namespaced=true时:
...mapstate("模块名字",[需要导入的值])
辅助函数Mapstate,mapGetters ,mapActions,mapMUtations
import {mapState}
在computed里解构
...mapState([A,B,C]) 直接{{A}} 使用
...mapGetters([D,E,F]) 直接{{D}}使用
在methods里结构
...mapActions([A,B])
...mapMUtations([A,B]) 直接this.A()调用
vuex模块化
export default{
state:{
namespaced:true;命名空间
}.....
}

vue