-
-
Save championswimmer/0ae91192f75fa962642aecf05c30f035 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Module, VuexModule, Mutation, Action} from 'vuex-module-decorators' | |
@Module | |
export default class Counter2 extends VuexModule { | |
count = 0 | |
@Mutation increment(delta: number) {this.count+=delta} | |
@Mutation decrement(delta: number) {this.count-=delta} | |
// action 'incr' commits mutation 'increment' when done with return value as payload | |
@Action({commit: 'increment'}) incr() {return 5} | |
// action 'decr' commits mutation 'decrement' when done with return value as payload | |
@Action({commit: 'decrement'}) decr() {return 5} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment