blog-admin icon indicating copy to clipboard operation
blog-admin copied to clipboard

store/modules 遍历错误,导致 vuex的namespaced异常

Open seaton-git opened this issue 5 years ago • 1 comments

src/store/modules/index.ts

files.keys().forEach(key => {
  if (key === './index.js') return // 应为 key === './index.ts' 
  modules[key.replace(/(\.\/|\.ts)/g, '')] = files(key).default
})

否则,在 src/store/index.ts

export default new Vuex.Store({
  state,
  actions,
  mutations,
  modules: {
    modules  // 无法正常使用namespaced
  }
})

seaton-git avatar Jul 30 '18 09:07 seaton-git

是的,多谢指出。

jkchao avatar Jul 30 '18 09:07 jkchao