Skip to content

Instantly share code, notes, and snippets.

@meshboy
Last active September 13, 2018 01:44
Show Gist options
  • Save meshboy/275a845adef636e5687c2c0ece84959b to your computer and use it in GitHub Desktop.
Save meshboy/275a845adef636e5687c2c0ece84959b to your computer and use it in GitHub Desktop.
<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