vuex

时间:2019-06-29 09:57:45   收藏:0   阅读:85

vuex 五步走:

  1. npm  install vue  -S

  2. vue.use(Vuex)

  3. 创建一个store模块,定义状态管理的规则 state,mutations,actions,getters,module

  4. 把store模块注册到viewmodel

  5. this.$store 来访问这个 store

    mapGetters把store中的getter方法映射到组建中的computer属性上

    mapActions

    mapMutations

    mapState

    dispatch("事件")

原文:https://www.cnblogs.com/manban/p/11105437.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!