Skip to content

Instantly share code, notes, and snippets.

@lakshyabatman
Created May 6, 2020 11:42
Show Gist options
  • Save lakshyabatman/32005832f218add6b5e7f5e0d68727d8 to your computer and use it in GitHub Desktop.
Save lakshyabatman/32005832f218add6b5e7f5e0d68727d8 to your computer and use it in GitHub Desktop.
Class Based component using store module
<template>
<div>
{{getCount}}
<br/>
<button @click="increase">-</button>
<button @click="decrease">+</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import { Component } from 'vue-property-decorator';
import Counter from '../store/module/counter'
@Component({})
export default class AppComponent extends Vue {
get getCount() {
return Counter.getCounter;
}
increase() {
Counter.increment();
}
decrease() {
Counter.decrement();
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment