Ich habe eine dumme Frage, die ich denke, aber ich brauche deine Hilfe. Ich erstelle eine Benachrichtigung Komponenten, die immer noti von Axios Real Time (immer neu laden), aber ich bin verwirrend, es zu machen.Get API in Komponenten der Benachrichtigung durch Echtzeit - NuxtJS
Meine Komponenten Benachrichtigung:
<template>
<ul class="tab-content">
<notification-item></notification-item>
</ul>
</template>
<script>
import ItemNotification from '~/components/header/NotificationItem.vue'
export default {
components: {
'notification-item': ItemNotification
},
created() {
this.$store.dispatch('getNotification')
}
}
</script>
Module Benachrichtigung: /store/notification.js.
import api from '~/plugins/axios'
const state =() => {
return {
notifications: null
}
}
const actions = {
getNotification ({commit}, config) {
api.get(`/notifications/`, config)
.then(response => {
commit('GET_NOTIFICATION', response.data)
})
}
}
const getters = {}
const mutations = {
GET_NOTIFICATION (state, notifications) {
state.notifications = notifications
}
}
export default {
state,
actions,
getters,
mutations
}
Diese Zeile dieses $ store.dispatch ('getNotification') nicht Arbeit? Wie kann ich es am besten machen oder hast du ein Beispielprojekt in Github, zeig es mir. Bitte hilf mir !!!
Das ist richtig . Es klappt. Aber bitte helfen Sie mir das Problem, wie kann ich diese Benachrichtigung Komponenten immer laden Methoden GetNotifications in Real Time? –
@FeedGit was meinst du mit Reload-Methoden? –
Wie Benachrichtigung von Facebook, lädt es bei Änderung URL !! –