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

登录时getAllPathPowers方法的问题 #31

Open
tianzhiyahaizhijiao opened this issue Dec 4, 2017 · 1 comment
Open

登录时getAllPathPowers方法的问题 #31

tianzhiyahaizhijiao opened this issue Dec 4, 2017 · 1 comment

Comments

@tianzhiyahaizhijiao
Copy link

function getAllPathPowers (menuArray, curPowers) {
return menuArray.reduce((dir, item) => {
dir[/${item.key}] = curPowers[item.id]
if (item.children) {
item.children.reduce((cdir, cur) => {
dir[/${cdir}/${cur.key}] = curPowers[cur.id]
return cdir
}, item.key)
getAllPathPowers(item.children, curPowers)
}
return dir
}, {})
}

这个封装的方法应该得不到所有的path

@pmg1989
Copy link
Owner

pmg1989 commented Dec 5, 2017

嗯,有好的解决方法,欢迎pr给我

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