Vuex 错误:unknown action type: generateRoutes 解决方法
这个错误提示是 Vuex 在执行 dispatch 操作时,找不到指定的 action 类型 'generateRoutes'。
需要检查你的代码中是否有定义 'generateRoutes' action,如果没有,则需要添加该 action。
例如,在 Vuex 的 store 中添加 'generateRoutes' action:
const store = new Vuex.Store({
state: {
// ...
},
mutations: {
// ...
},
actions: {
'generateRoutes'({ commit }) {
// do something
}
}
})
如果已经定义了 'generateRoutes' action,那么需要检查你在 dispatch 操作时是否拼写错误或者传入的参数有误。需要确认在哪里调用 dispatch 并进行修改。
原文地址: https://www.cveoy.top/t/topic/oIt2 著作权归作者所有。请勿转载和采集!