组件之间数据共享

组件之间的数据同步与共享

如何在组件中使用mutations内的方法?

methods: {
     addOne () {
       this.$store.commit('increment', this.price)
     },
     minusOne () {
       this.$store.commit('decrement', this.price)
     }
   }

如何在组件中使用actions内的方法?

methods: {
     addOne () {
       this.$store.dispatch('increase', this.price)
     }
   }

 

posted on 2018-11-08 16:43  云点西西  阅读(306)  评论(0编辑  收藏  举报

导航