Created
May 6, 2020 11:42
-
-
Save lakshyabatman/32005832f218add6b5e7f5e0d68727d8 to your computer and use it in GitHub Desktop.
Class Based component using store module
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
<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