Skip to content

Commit c890b62

Browse files
author
Guillaume Chau
committed
chore(dev): add another nested mutation
1 parent 33afb40 commit c890b62

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

shells/dev/target/Counter.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<p>foo: {{ foo }}</p>
1717
<p>twoFoos: {{ twoFoos }}</p>
1818
<button @click="addBar">Add bar</button>
19+
<button @click="removeBar">Remove bar</button>
1920
</div>
2021
</div>
2122
</template>
@@ -69,7 +70,8 @@ export default {
6970
},
7071
7172
...mapMutations('nested', {
72-
addBar: 'ADD_BAR'
73+
addBar: 'ADD_BAR',
74+
removeBar: 'REMOVE_BAR'
7375
})
7476
}
7577
}

shells/dev/target/store.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export default new Vuex.Store({
6262
mutations: {
6363
ADD_BAR: (state) => {
6464
state.foo += 'bar'
65+
},
66+
REMOVE_BAR: (state) => {
67+
state.foo = state.foo.substr('bar'.length)
6568
}
6669
}
6770
}

0 commit comments

Comments
 (0)