【VUE学习笔记】VUEX模块化编码--手写VS自动生成

对于vuex的state,getters,commit,dispatch函数,建议选择自动生成

手写VUEX 自动生成
this.$store.state.分类.数据 …mapState( ‘分类’ , [ ‘数据’ ] )
this.$store.getters[ ‘分类/数据’ ] …mapGetters( ‘分类’ , [ ‘数据’ ] )
this.$store.commit( ‘分类/函数’ , 数据 ) …mapMutations( ‘分类’ , { 此处数据名 :‘index数据名’ } )
this.$store.dispatch( ‘分类/函数’ , 数据 ) …mapActions( ‘分类’ , { 此处数据名 :‘index数据名’ } )

你可能感兴趣的:(VUE学习笔记,前端,css3,html,vue)