使用 mudule 时,在一个模块中提交另一个模块的 mutation,会报 unknown local mutation type
作者: LiYanyan-a创建于 2024年7月15日更新于 2025年11月10日
创建 store 代码: import getters from './getters' import modules from './modules' import { createStore } from 'vuex' const store = createStore({ getters, modules, })
export function setupStore(app) { app.use(store); } 无法找到 mutation type 的模块代码 import * as R from 'ramda' import http from '@/utils/http'
export default { namespaced: true, state: {}, mutations: { SET_DATA (state, { name, data }) { state[name] = data }, DEL_DATA (state, { name }) { delete state[name] }, }, actions: { async get ({ commit, rootGetters }, { category, onFinally }) {
},
}, }
内容来源: vuejs/vuex