Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
seaton-git opened this issue Jul 30, 2018 · 1 comment
Open

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

seaton-git opened this issue Jul 30, 2018 · 1 comment

Comments

@seaton-git
Copy link

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
  }
})
@jkchao
Copy link
Owner

jkchao commented Jul 30, 2018

是的,多谢指出。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants