vuex介绍使用

store 组织架构

store{

moudleA{

state:{}
mutation:{
#####   纯函数
}
getters{  定义一些响应式属性类似于 computed  }
action:{
####		处理异步函数 例如登录注册	
}

}

}

组件中调用

methods: {

...mapGetters([''getter的名字'']),
这样就就可以直接调用 对应的getter 了 
   ...mapActions(['Login', 'Logout']),
   这样就可以调用对应的action了

}

交互——》事件——》action——》mutation——》state——》v

posted on 2019-06-27 11:10  fxxk院子  阅读(47)  评论(0)    收藏  举报

导航