Last active
July 23, 2019 09:23
-
-
Save harrybeckwith/08718c3a576ea6b21efe695e579a7ddf to your computer and use it in GitHub Desktop.
mapGetters and mapState
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> | |
<h1>Create Event {{ userName }}</h1> | |
<p>There are {{catLength}} categories</p> | |
<ul> | |
<li v-for="cat in categories" :key="cat"> | |
{{cat}} | |
</li> | |
</ul> | |
<p> | |
{{ getEventById(3) }} | |
</p> | |
</div> | |
</template> | |
<script> | |
import { mapState, mapGetters } from 'vuex' | |
export default { | |
computed: { | |
...mapState(['user', 'categories']), | |
...mapGetters(['getEventById', 'catLength']) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment