1
0
Эх сурвалжийг харах

Update Counter Hot Example (#1226)

* Make mutations responsible for updating one piece

* update history from mutations

* rename Counter to CounterControls

* remove unnecessary commit call
Alex Kyriakidis 7 жил өмнө
parent
commit
61082d6abb

+ 0 - 0
examples/counter-hot/Counter.vue → examples/counter-hot/CounterControls.vue


+ 2 - 2
examples/counter-hot/app.js

@@ -1,9 +1,9 @@
 import Vue from 'vue'
 import store from './store'
-import Counter from './Counter.vue'
+import CounterControls from './CounterControls.vue'
 
 new Vue({
   el: '#app',
   store,
-  render: h => h(Counter)
+  render: h => h(CounterControls)
 })

+ 6 - 2
examples/counter-hot/store/actions.js

@@ -1,5 +1,9 @@
-export const increment = ({ commit }) => commit('increment')
-export const decrement = ({ commit }) => commit('decrement')
+export const increment = ({ commit }) => {
+  commit('increment')
+}
+export const decrement = ({ commit }) => {
+  commit('decrement')
+}
 
 export const incrementIfOdd = ({ commit, state }) => {
   if ((state.count + 1) % 2 === 0) {