Last active
November 10, 2020 16:04
-
-
Save 34fame/c14744d73bdfac2fac3d2158a5cd5e7e to your computer and use it in GitHub Desktop.
Vue component calling real-time listener
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> | |
<div v-for="user in users" :key="user.id"> | |
{{ JSON.stringify(user) }} | |
</div> | |
</div | |
</template> | |
<script> | |
import { mapActions, mapGetters } from 'vuex' | |
export default { | |
computed: { | |
...mapGetters(['users/all']), | |
users() { | |
return this['users/all'] | |
} | |
}, | |
methods: { | |
...mapActions(['users/bindUsers']), | |
}, | |
created() { | |
this['users/bindUsers']() | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment