浏览代码

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 年之前
父节点
当前提交
61082d6abb
共有 3 个文件被更改,包括 8 次插入4 次删除
  1. 0 0
      examples/counter-hot/CounterControls.vue
  2. 2 2
      examples/counter-hot/app.js
  3. 6 2
      examples/counter-hot/store/actions.js

+ 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) {