mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
40 lines
1.4 KiB
React
40 lines
1.4 KiB
React
|
import React from 'react';
|
||
|
|
||
|
|
||
|
const redirect = {
|
||
|
'/docs/resource/download': '/docs/spec/download',
|
||
|
'/docs/resource/download-cn': '/docs/spec/download-cn',
|
||
|
'/docs/resource/reference': '/docs/spec/reference',
|
||
|
'/docs/resource/reference-cn': '/docs/spec/reference-cn',
|
||
|
'/docs/spec/feature': '/docs/spec/values',
|
||
|
'/docs/spec/feature-cn': '/docs/spec/values-cn',
|
||
|
'/docs/pattern/advanced-search': '/docs/spec/overview',
|
||
|
'/docs/pattern/advanced-search-cn': '/docs/spec/overview-cn',
|
||
|
'/docs/pattern/complex-table': '/docs/spec/overview',
|
||
|
'/docs/pattern/complex-table-cn': '/docs/spec/overview-cn',
|
||
|
'/docs/pattern/from': '/docs/spec/overview',
|
||
|
'/docs/pattern/from-cn': '/docs/spec/overview-cn',
|
||
|
'/docs/pattern/list': '/docs/spec/overview',
|
||
|
'/docs/pattern/list-cn': '/docs/spec/overview-cn',
|
||
|
'/docs/pattern/navigation': '/docs/spec/navigation',
|
||
|
'/docs/pattern/navigation-cn': '/docs/spec/navigation-cn',
|
||
|
'/docs/pattern/table': '/docs/spec/overview',
|
||
|
'/docs/pattern/table-cn': '/docs/spec/overview-cn',
|
||
|
};
|
||
|
|
||
|
export default class Redirect extends React.Component {
|
||
|
componentDidMount() {
|
||
|
const { location } = this.props;
|
||
|
const pathname = `/${location.pathname}`;
|
||
|
Object.keys(redirect).forEach((from) => {
|
||
|
if (pathname.indexOf(from) === 0) {
|
||
|
window.location.href = redirect[from];
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return <div />;
|
||
|
}
|
||
|
}
|