报错提示
permission.js:107 [vuex] module namespace not found in mapState(): oaaserver/
- 原因:新加的store模块oaaserver,再导出时没写命名允许
namespaced: true
// store 的一个模块 addxxx
const addxxx= {
state:{
list:[],
},
mutations:{
setList : (state, val) => {
state.list= val
},
},
actions:{
getList({ commit }){
return request({
url: '/xxx'
}).then(res => {
commit('setList ', res.data.response)
}).catch(() => {
return errorMsg('xxx')
})
},
//.....
}
}
export default {
namespaced: true, // 需要添加空间命名,在后面使用mapState时才能找到,否者会报错找不到
...addxxx
}