Skip to content

Instantly share code, notes, and snippets.

@34fame
Last active November 10, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 34fame/c14744d73bdfac2fac3d2158a5cd5e7e to your computer and use it in GitHub Desktop.
Save 34fame/c14744d73bdfac2fac3d2158a5cd5e7e to your computer and use it in GitHub Desktop.
Vue component calling real-time listener
<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