mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
site: unify link
This commit is contained in:
parent
7ea4dfa501
commit
dfc26727d8
@ -37,7 +37,7 @@ module.exports = {
|
||||
path: 'changelog',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: 'components/:children',
|
||||
path: 'components/:children/',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: 'docs/spec/:children',
|
||||
|
@ -59,7 +59,7 @@ export default class MainContent extends React.Component {
|
||||
const disabled = item.disabled;
|
||||
const url = item.filename.replace(/(\/index)?((\.zh-CN)|(\.en-US))?\.md$/i, '').toLowerCase();
|
||||
const child = !item.link ?
|
||||
<Link to={url} disabled={disabled}>
|
||||
<Link to={/^components/.test(url) ? `${url}/` : url} disabled={disabled}>
|
||||
{text}
|
||||
</Link> :
|
||||
<a href={item.link} target="_blank" disabled={disabled}>
|
||||
|
@ -90,7 +90,9 @@ export default class Header extends React.Component {
|
||||
|
||||
render() {
|
||||
const { location, components } = this.props;
|
||||
const module = location.pathname.split('/').slice(0, -1).join('/');
|
||||
const module = location.pathname.replace(/\/$/, '')
|
||||
.split('/').slice(0, -1)
|
||||
.join('/');
|
||||
let activeMenuItem = module || 'home';
|
||||
if (activeMenuItem === 'components' || location.pathname === 'changelog') {
|
||||
activeMenuItem = 'docs/react';
|
||||
|
Loading…
Reference in New Issue
Block a user