fix(fetch): load sidebar and navbar for parent path, fixed #100

This commit is contained in:
qingwei.li 2017-02-28 21:16:10 +08:00 • committed by cinwell.li
commit f3fc596951
2 changed files with 20 additions and 14 deletions

View file

@ -45,8 +45,12 @@ export const isAbsolutePath = cached(path => {
return /(:|(\/{2}))/.test(path)
})
export const getRoot = cached(path => {
return /\/$/g.test(path) ? path : path.match(/(\S*\/)[^\/]+$/)[1]
export const getParentPath = cached(path => {
return /\/$/g.test(path)
? path
: (path = path.match(/(\S*\/)[^\/]+$/))
? path[1]
: ''
})
export const cleanPath = cached(path => {