docs_vue2/common/nav.js
2021-08-23 19:37:43 +08:00

19 lines
421 B
JavaScript

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