Last active
September 13, 2018 01:44
-
-
Save meshboy/275a845adef636e5687c2c0ece84959b 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
<template> | |
<div> | |
<p> Counter value is: {{ counter }} </p> | |
<p> Counter incremental value is: {{ increment }} </p> | |
</div> | |
</template> | |
<script> | |
import { | |
mapGetters | |
} from 'vuex'; | |
export default { | |
name: 'appResult', | |
/** | |
* map the method(s) in getters to a property | |
*/ | |
// computed: mapGetters({ | |
// counter: 'addCurrencyToCounter', | |
// increment: 'incrementCounterByTen' | |
// }) | |
/** | |
* **** using spread operator **** | |
* This is useful when other properties are to be | |
* added to computed proptery | |
*/ | |
computed: { | |
...mapGetters({ | |
counter: 'addCurrencyToCounter', | |
increment: 'incrementCounterByTen' | |
}) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment