Tomi
1 year ago
318
3
Nova

How to add Vuex to Laravel Nova?

Posted 1 year ago by Tomi

So i am working on a new Tool for Nova, and i need Vuex to make it work. Is there a way to add Vuex to laravel Nova?

I would usually just add it in the Vue instance:

store js:

import Vuex from 'vuex';


Vue.use(Vuex);

app.js:

import {store} from './store/store';


new Vue({

    el: '#prm',

    i18n,

    store,

but in the tools.js component the Vue instance is already defined and this sadly doesnt work:

Nova.booting((Vue, router) => {
    router.addRoutes([
        {
            name: 'voucher-editor',
            path: '/voucher-editor',
            component: require('./components/Tool'),
        },
    ])
})

Vue.store = store;

Any one had a problem like this? How do you add in general new plugins to an existing Vue instance?

Please sign in or create an account to participate in this conversation.