Skip to content

Commit 61082d6

Browse files
hootlexktsn
authored andcommitted
Update Counter Hot Example (#1226)
* Make mutations responsible for updating one piece * update history from mutations * rename Counter to CounterControls * remove unnecessary commit call
1 parent 4d5af05 commit 61082d6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

examples/counter-hot/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Vue from 'vue'
22
import store from './store'
3-
import Counter from './Counter.vue'
3+
import CounterControls from './CounterControls.vue'
44

55
new Vue({
66
el: '#app',
77
store,
8-
render: h => h(Counter)
8+
render: h => h(CounterControls)
99
})

examples/counter-hot/store/actions.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
export const increment = ({ commit }) => commit('increment')
2-
export const decrement = ({ commit }) => commit('decrement')
1+
export const increment = ({ commit }) => {
2+
commit('increment')
3+
}
4+
export const decrement = ({ commit }) => {
5+
commit('decrement')
6+
}
37

48
export const incrementIfOdd = ({ commit, state }) => {
59
if ((state.count + 1) % 2 === 0) {

0 commit comments

Comments
 (0)