I have tons of nested Vue components that need to be able to open a global modal. To avoid having tons of listeners and emitters snaking their way all through the app, I am using VueX. The main App has a modal which gets shown if the modal state is not undefined.
rootRoot app template
<template>
<components></components>
<popup v-if="popupImage" :image="popupImage"></popup>
</template>
rootRoot app script
import { State } from 'vuex-class'
@State(state => state.popupImage) popupImage:string
nestedNested component
From within a component I set the popup string, which will trigger the global modal.:
this.$store.commit("setPopup", "bla.jpg")
It all works fine, but does it seemsseem a bit overkill to add VueX ONLY for a modal window? The rest of the app doesn't use VueX at all. What is the recommended way to open a modal from anywhere in a Vue app?