Skip to content

Commit fdd9c3f

Browse files
committed
docs: update site
1 parent 0778cc0 commit fdd9c3f

File tree

4 files changed

+22
-26
lines changed

4 files changed

+22
-26
lines changed

site/components/header.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { isZhCN } from '../util'
3-
import _ from 'lodash'
3+
import sortBy from 'lodash/sortBy'
44
export default {
55
props: {
66
name: String,
@@ -27,7 +27,7 @@ export default {
2727
},
2828
render () {
2929
const name = this.name
30-
const searchData = _.sortBy(this.searchData, ['title'])
30+
const searchData = sortBy(this.searchData, ['title'])
3131
const isCN = isZhCN(name)
3232
return (
3333
<header id='header'>

site/components/layout.vue

+11-21
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<script>
2-
import Vue from 'vue'
32
import AllDemo from '../demo'
43
import Header from './header'
54
import zhCN from 'antd/locale-provider/zh_CN'
65
import enUS from 'antd/locale-provider/default'
7-
import _ from 'lodash'
6+
import sortBy from 'lodash/sortBy'
87
import { isZhCN } from '../util'
98
import { 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>

site/index.less

+3
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,6 @@
8484
border: none;
8585
}
8686
}
87+
.toc-affix .ant-affix {
88+
overflow: visible;
89+
}

webpack.site.config.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@ module.exports = merge(baseWebpackConfig, {
5959
},
6060
}),
6161
new webpack.optimize.CommonsChunkPlugin({
62-
name: 'manifest',
63-
minChunks: Infinity,
62+
name: 'vender',
63+
minChunks: function (module) {
64+
return /node_modules/.test(module.context)
65+
},
6466
}),
6567
new webpack.optimize.CommonsChunkPlugin({
66-
name: 'vender',
68+
name: 'manifest',
69+
minChunks: Infinity,
6770
}),
6871
new webpack.optimize.UglifyJsPlugin({
6972
compress: {

0 commit comments

Comments
 (0)