[Vuejs]-Emit eventHub inside vuex

0๐Ÿ‘

iโ€™ve already solved it ๐Ÿ™‚
the solution was create a new folder/file like this:

folder: eventHub/index.js

file contents:

import Vue from "vue";
const eventBus = new Vue()
export default eventBus

and then in the router file simple import and use

import eventHub from '@/eventHub'

eventHub.$emit('something');

pulled from the official docs:
vue docs events

Leave a comment