對不起我的英語不好。
我正在 Nuxt vuetify 上開發一個應用程式。
我想使用商店,但我收到一條錯誤訊息。我在網上搜索,但沒有結果。
我的代碼在商店
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;
我的錯誤資訊
TypeError Object(...) 不是函式
如果您需要更多資訊,請隨時詢問。
謝謝你的幫助
uj5u.com熱心網友回復:
你可以檢查這個樣本,也許它可以解決你的問題
import Vuex from 'vuex'
const createStore = () => {
return new Vuex.Store({
state: () => ({
}),
mutations: {
},
actions: {}
})
}
export default createStore
從這里閱讀更多
uj5u.com熱心網友回復:
謝謝,可以的。
我的代碼
// 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
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/497716.html
標籤:javascript nuxt.js Vuetify.js
上一篇:JS更改具有特定id和類名的元素
