11<script >
2- import Vue from ' vue'
32import AllDemo from ' ../demo'
43import Header from ' ./header'
54import zhCN from ' antd/locale-provider/zh_CN'
65import enUS from ' antd/locale-provider/default'
7- import _ from ' lodash'
6+ import sortBy from ' lodash/sortBy '
87import { isZhCN } from ' ../util'
98import { Provider , create } from ' ../../components/_util/store'
109
@@ -78,24 +77,14 @@ export default {
7877 const lis = []
7978 currentSubMenu .forEach (({ cnTitle, usTitle, id }) => {
8079 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} / > )
8381 })
8482 const showApi = this .$route .path .indexOf (' /components/' ) !== - 1
8583 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>
9988 )
10089 },
10190 getDocsMenu (isCN ) {
@@ -160,7 +149,7 @@ export default {
160149 const MenuGroup = []
161150 for (const [type , menus ] of Object .entries (menuConfig)) {
162151 const MenuItems = []
163- _ . sortBy (menus, [' title' ]).forEach (({ title, subtitle }) => {
152+ sortBy (menus, [' title' ]).forEach (({ title, subtitle }) => {
164153 const linkValue = isCN
165154 ? [< span> {title}< / span> , < span class = ' chinese' > {subtitle}< / span> ]
166155 : [< span> {title}< / span> ]
@@ -183,7 +172,8 @@ export default {
183172 if (! isCN) {
184173 locale = enUS
185174 }
186- this .resetDocumentTitle (AllDemo[titleMap[reName]], reName, isCN)
175+ const config = AllDemo[titleMap[reName]]
176+ this .resetDocumentTitle (config, reName, isCN)
187177 return (
188178 < div class = ' page-wrapper' >
189179 < Header searchData= {searchData} name= {name}/ >
@@ -205,11 +195,11 @@ export default {
205195 < / a- col>
206196 < a- col span= {18 }>
207197 < div class = ' content main-container' >
208- < div class = ' toc-affix' style= ' width: 110px ;' >
198+ < div class = ' toc-affix' style= ' width: 120px ;' >
209199 {this .getSubMenu (isCN)}
210200 < / div>
211201 {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>
213203 < / Provider> : ' ' }
214204 {this .showApi ? < div class = ' markdown api-container' ref= ' doc' >
215205 < router- view>< / router- view>
0 commit comments