Answers for "vue store access vue instanvce"

0

vue store access vue instanvce

import App from './App.vue';

const myStore = new Vuex.Store({
    state: {
        ...
    },
    actions: {
        myAction(ctx, data) {
              // here you can use this.$app to access to your vue application
        }
    }
});

const app = new Vue({
    el: '#my-div',
    render: h => h(App),
    store: myStore
});

myStore.$app = app; // <--- !!! this line adds $app to your store object
Posted by: Guest on May-18-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language