Home > Software engineering >  Object(...) is not a function with vuetify
Object(...) is not a function with vuetify

Time:07-04

sorry for my english.

I am developing an app on Nuxt vuetify.

I want to use the store, but I have an error message. I searched on web, but no results work.

My code in store

import { createStore } from 'vuetify';
// import createStore from 'vuex';

const store = createStore({
    state: {},
    mutation: {},
    actions: {
        createAccount: ({ commit, userInfos }) => {
            commit;
            console.log(userInfos);
        }
    }
})
console.log(store);

export default store;

My error message

TypeError Object(...) is not a function

If you need more information, feel free to ask.

Thanks for your help

CodePudding user response:

you can check this sample, perhaps it can solve your problem

import Vuex from 'vuex'

const createStore = () => {
  return new Vuex.Store({
    state: () => ({
    }),
    mutations: {
    },
    actions: {}
  })
}

export default createStore

read more from here

CodePudding user response:

Thanks, It ok.

My code

// I saw this way is deprecated, and that would be delete in Nuxt3

import Vuex from 'vuex'

const createStore = () => {
    return new Vuex.Store({
        state: () => ({}),
        mutations: {},
        actions: {
            createAccount: ({ commit }, userSignUp) => {
                commit;
                console.log(userSignUp);
            }
        }
    })
}

export default createStore

  • Related