vuex

1.state 放置你想储存于仓库的东西

2.mutations 用来操作,改states里面的数据的

3.getters 用来更好的处理组装数据的

4.mapState mapGatter 

在computed里面直

...mapState(['state里面放置的数据名称'])

 ...mapState({
      username: state => state.currentUser.userName
    }),

 注意:使用...这个东西必须安装

actions 处理异步的操作 :写在methods里面,他是操作

mutations 处理简单的同步的操作: 写在mouted周期函数中

下面是使用action的两个帮助方法

mapActions

matMutations

传入actions的名字,然后就可以在mouted的周期函数中直接调用了

原文地址:https://www.cnblogs.com/joer717/p/11285017.html