6
6
v-for =" item in userLinks"
7
7
:key =" item.link" >
8
8
<div
9
- v-if =" item.type === 'dropdown '"
9
+ v-if =" item.type === 'links '"
10
10
class =" dropdown-wrapper" >
11
11
<span class =" dropdown-title" >{{ item.text }}</span >
12
12
<span class =" arrow" ></span >
13
13
<ul class =" nav-dropdown" >
14
14
<li
15
15
v-for =" subItem in item.items"
16
16
:key =" subItem.link" >
17
- <nav-link :item =" subItem" ></nav-link >
17
+ <h4 v-if =" subItem.type === 'links'" >{{ subItem.text }}</h4 >
18
+ <ul v-if =" subItem.type === 'links'" >
19
+ <li
20
+ v-for =" childSubItem in subItem.items"
21
+ :key =" childSubItem.link" >
22
+ <nav-link :item =" childSubItem" ></nav-link >
23
+ </li >
24
+ </ul >
25
+ <nav-link v-else :item =" subItem" ></nav-link >
18
26
</li >
19
27
</ul >
20
28
</div >
35
43
<script >
36
44
import OutboundLink from ' ./OutboundLink.vue'
37
45
import NavLink from ' ./NavLink.vue'
38
- import { isActive , ensureExt } from ' ./util'
46
+ import { isActive , resolveNavLinkItem } from ' ./util'
39
47
40
48
export default {
41
49
components: { OutboundLink, NavLink },
42
50
computed: {
43
51
userLinks () {
44
- return (this .$site .themeConfig .nav || []).map (({ text, link, type, items }) => ({
45
- text,
46
- type,
47
- link: link ? ensureExt (link) : null ,
48
- items: (items || []).map (({ text, link }) => ({ text, link: ensureExt (link) }))
52
+ return (this .$site .themeConfig .nav || []).map ((link => {
53
+ return Object .assign (resolveNavLinkItem (link), {
54
+ items: (link .items || []).map (resolveNavLinkItem)
55
+ })
49
56
}))
50
57
},
51
58
githubLink () {
@@ -81,7 +88,6 @@ export default {
81
88
line-height 2rem
82
89
.dropdown-wrapper
83
90
cursor pointer
84
- padding-right 15
85
91
& :hover .nav-dropdown
86
92
display block
87
93
.arrow
@@ -98,12 +104,15 @@ export default {
98
104
li
99
105
color inherit
100
106
line-height 1.7rem
101
- padding 0 1.5rem 0 1.25rem
102
107
a
108
+ display block
109
+ height 1.7rem
110
+ line-height 1.7rem
103
111
position relative
104
112
border-bottom none
105
113
font-weight 400
106
114
margin-bottom 0
115
+ padding 0 1.5rem 0 1.25rem
107
116
& :hover
108
117
color $accentColor
109
118
& .router-link-active
@@ -117,7 +126,18 @@ export default {
117
126
border-bottom 4px solid transparent
118
127
position absolute
119
128
top calc (50% - 3px )
120
- left - 10px
129
+ left 10px
130
+ & :first-child h4
131
+ margin-top : 0 ;
132
+ padding-top : 0 ;
133
+ border-top : 0 ;
134
+ & > h4
135
+ margin 0.45rem 0 0
136
+ border-top 1px solid #e e e
137
+ padding 0.45rem 1.5rem 0 1.25rem
138
+ & > ul
139
+ padding 0
140
+ list-style none
121
141
.github-link
122
142
margin-left 1.5rem
123
143
0 commit comments