Skip to content

Commit 1943dcc

Browse files
committed
feat: update nav
1 parent d9a648f commit 1943dcc

File tree

4 files changed

+368
-329
lines changed

4 files changed

+368
-329
lines changed

common/nav.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
import { entries, sortBy } from 'lodash'
1+
// import { entries, sortBy } from 'lodash'
22
import nav from '../assets/data/nav.json'
33

4-
export default entries(nav).reduce((ret, [lang, items]) => {
5-
ret[lang] = items.map(item => {
6-
if (!item.children) {
7-
return item
8-
}
9-
return {
10-
...item,
11-
children:
12-
item.slug === 'components'
13-
? sortBy(item.children, child => child.title)
14-
: item.children
15-
}
16-
})
17-
return ret
18-
}, {})
4+
// export default entries(nav).reduce((ret, [lang, items]) => {
5+
// ret[lang] = items.map(item => {
6+
// if (!item.children) {
7+
// return item
8+
// }
9+
// return {
10+
// ...item,
11+
// children:
12+
// item.slug === 'components'
13+
// ? sortBy(item.children, child => child.title)
14+
// : item.children
15+
// }
16+
// })
17+
// return ret
18+
// }, {})
19+
20+
export default nav

components/OneMenu.vue

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@
2222
:items="menuItems"
2323
:expanded.sync="menuExpanded"
2424
>
25-
<template #item-label="{ label, sub }">
26-
{{ label }}<small v-if="sub">{{ sub }}</small>
25+
<template #item-label="{ label, sub, cn }">
26+
<small
27+
v-if="sub"
28+
class="sub"
29+
>⤷</small>{{ label
30+
}}<small
31+
v-if="cn"
32+
class="cn"
33+
>{{ cn }}</small>
2734
</template>
2835
</veui-menu>
2936
</nav>
@@ -70,26 +77,29 @@ export default {
7077
},
7178
methods: {
7279
getTitleDetail (title) {
73-
let [main, sub] = title.split(' - ')
74-
return [main, sub]
80+
let [main, cn] = title.split(' - ')
81+
return [main, cn]
7582
},
7683
isActive (path) {
7784
let { route = {} } = this.$router.resolve(path) || {}
7885
return route.name === this.$route.name
7986
},
80-
normalizeItem ({ title, children, slug, link, disabled }, base = '') {
87+
normalizeItem ({ title, children, slug, sub, link, disabled }, base = '') {
8188
const fullSlug = `${base}/${slug}`
8289
const localePath = this.getLocalePath(fullSlug)
83-
const to = (link !== false && fullSlug && !disabled) ? localePath : null
84-
const [main, sub] = this.getTitleDetail(title)
90+
const to = link !== false && fullSlug && !disabled ? localePath : null
91+
const [main, cn] = this.getTitleDetail(title)
8592
8693
return {
8794
label: main,
88-
sub,
95+
cn,
8996
to,
9097
name: fullSlug,
98+
sub,
9199
disabled,
92-
children: children ? children.map(child => this.normalizeItem(child, fullSlug)) : []
100+
children: children
101+
? children.map(child => this.normalizeItem(child, fullSlug))
102+
: []
93103
}
94104
},
95105
toggleMenu () {
@@ -119,10 +129,14 @@ export default {
119129
border-radius 6px
120130
font inherit
121131
122-
small
132+
.cn
123133
margin-left 8px
124134
opacity 0.7
125135
136+
.sub
137+
margin-right 8px
138+
opacity 0.3
139+
126140
.toggle
127141
display none
128142

one/docs/components/pagination.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Pagination <small>翻页</small>
1+
# Pagination <small>分页</small>
22

33
## 示例
44

0 commit comments

Comments
 (0)