1
1
<script >
2
- import Vue from ' vue'
3
2
import AllDemo from ' ../demo'
4
3
import Header from ' ./header'
5
4
import zhCN from ' antd/locale-provider/zh_CN'
6
5
import enUS from ' antd/locale-provider/default'
7
- import _ from ' lodash'
6
+ import sortBy from ' lodash/sortBy '
8
7
import { isZhCN } from ' ../util'
9
8
import { Provider , create } from ' ../../components/_util/store'
10
9
@@ -78,24 +77,14 @@ export default {
78
77
const lis = []
79
78
currentSubMenu .forEach (({ cnTitle, usTitle, id }) => {
80
79
const title = isCN ? cnTitle : usTitle
81
- const className = decodeURIComponent (window .location .hash ) === ` #${ id} ` ? ' current' : ' '
82
- lis .push (< li title= {title}>< a href= {` #${ id} ` } class = {className}> {title}< / a>< / li> )
80
+ lis .push (< a- anchor- link href= {` #${ id} ` } title= {title} / > )
83
81
})
84
82
const showApi = this .$route .path .indexOf (' /components/' ) !== - 1
85
83
return (
86
- < a- affix>
87
- < ul id= ' demo-toc' class = ' toc' >
88
- {lis}
89
- {showApi ? < li title= ' API' key= ' API' >
90
- < a
91
- href= ' #API'
92
- class = {{
93
- current: window .location .hash === ' #API' ,
94
- }}
95
- > API < / a>
96
- < / li> : ' ' }
97
- < / ul>
98
- < / a- affix>
84
+ < a- anchor>
85
+ {lis}
86
+ {showApi ? < a- anchor- link title= ' API' href= ' #API' / > : ' ' }
87
+ < / a- anchor>
99
88
)
100
89
},
101
90
getDocsMenu (isCN ) {
@@ -160,7 +149,7 @@ export default {
160
149
const MenuGroup = []
161
150
for (const [type , menus ] of Object .entries (menuConfig)) {
162
151
const MenuItems = []
163
- _ . sortBy (menus, [' title' ]).forEach (({ title, subtitle }) => {
152
+ sortBy (menus, [' title' ]).forEach (({ title, subtitle }) => {
164
153
const linkValue = isCN
165
154
? [< span> {title}< / span> , < span class = ' chinese' > {subtitle}< / span> ]
166
155
: [< span> {title}< / span> ]
@@ -183,7 +172,8 @@ export default {
183
172
if (! isCN) {
184
173
locale = enUS
185
174
}
186
- this .resetDocumentTitle (AllDemo[titleMap[reName]], reName, isCN)
175
+ const config = AllDemo[titleMap[reName]]
176
+ this .resetDocumentTitle (config, reName, isCN)
187
177
return (
188
178
< div class = ' page-wrapper' >
189
179
< Header searchData= {searchData} name= {name}/ >
@@ -205,11 +195,11 @@ export default {
205
195
< / a- col>
206
196
< a- col span= {18 }>
207
197
< div class = ' content main-container' >
208
- < div class = ' toc-affix' style= ' width: 110px ;' >
198
+ < div class = ' toc-affix' style= ' width: 120px ;' >
209
199
{this .getSubMenu (isCN)}
210
200
< / div>
211
201
{this .showDemo ? < Provider store= {this .store } key= {isCN ? ' cn' : ' en' }>
212
- < router- view>< / router- view>
202
+ < router- view class = { ` demo-cols- ${ config . cols || 2 } ` } >< / router- view>
213
203
< / Provider> : ' ' }
214
204
{this .showApi ? < div class = ' markdown api-container' ref= ' doc' >
215
205
< router- view>< / router- view>
0 commit comments