1、辅助函数:
通过辅助函数mapState、mapActions、mapMutations,把vuex.store中的属性映射到vue实例身上,这样在vue实例中就能访问vuex.store中的属性了,对于操作vuex.store就很方便了。
state辅助函数为mapState,actions辅助函数为mapActions,mutations辅助函数为mapMutations。(Vuex实例身上有mapState、mapActions、mapMutations属性,属性值都是函数)
2、如何使用辅助函数
在当前组件中引入Vuex
通过Vuex来调用辅助函数
3、辅助函数如何去映射vuex.store中的属性
1、mapState:把state属性映射到computed身上
4、mapGetters:把getters属性映射到computed身上
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name&#