docs_vue2/common/nav.js

19 lines
421 B
JavaScript
Raw Normal View History

import { entries, sortBy } from 'lodash'
import nav from '../assets/data/nav.json'
2021-08-23 19:37:43 +08:00
export default entries(nav).reduce((ret, [lang, items]) => {
ret[lang] = items.map(item => {
if (!item.children) {
return item
}
return {
...item,
2021-08-23 19:37:43 +08:00
children:
item.slug === 'components'
? sortBy(item.children, child => child.title)
: item.children
}
})
return ret
}, {})