[Vuejs]-How do I get multiple actions and state with Vuex namespaced modules and the Vue Composition API?

0👍

This is a way to do it:

component.vue

  import { getCurrentInstance } from 'vue';

  setup() {
    const _instance = getCurrentInstance();
    const { $store } = _instance.appContext.app.config.globalProperties;
  },

createStore

"use strict";
import { createStore } from 'vuex';

// Stores
import moduleA from '@/store/moduleA.js';
import moduleB from '@/store/moduleB.js';

export const store = createStore({
  strict: true,
  modules: {
    moduleA,
    moduleB,
  }
});

Leave a comment