How do I make my store globally available in vue 3 with vuex?
My store:
import { createStore } from 'vuex'
export default createStore({
state: {},
mutations: {},
getters: {},
actions: {},
modules: {},
})
My main.ts
import yourStore from './store/yourStore'
const app = createApp(App)
app.use(yourStore)
app.config.globalProperties.$yourStore = yourStore
app.mount('#app')
This doesn't work:
this.$yourStore.dispatch('your action')