mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
Merge branch 'master' of github.com:ant-design/ant-design
This commit is contained in:
commit
2af8f6f95c
@ -25,25 +25,25 @@ module.exports = {
|
||||
component: './template/Layout/index',
|
||||
indexRoute: { component: './template/Home/index' },
|
||||
childRoutes: [{
|
||||
path: '/docs/practice/:children',
|
||||
path: 'docs/practice/:children',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: '/docs/pattern/:children',
|
||||
path: 'docs/pattern/:children',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: '/docs/react/:children',
|
||||
path: 'docs/react/:children',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: '/changelog',
|
||||
path: 'changelog',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: '/components/:children',
|
||||
path: 'components/:children',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: '/docs/spec/:children',
|
||||
path: 'docs/spec/:children',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: '/docs/resource/:children',
|
||||
path: 'docs/resource/:children',
|
||||
component: contentTmpl,
|
||||
}],
|
||||
},
|
||||
|
@ -6,7 +6,6 @@ import ComponentDoc from './ComponentDoc';
|
||||
import * as utils from '../utils';
|
||||
import config from '../../';
|
||||
const SubMenu = Menu.SubMenu;
|
||||
let firstMounted = false;
|
||||
|
||||
export default class MainContent extends React.Component {
|
||||
static contextTypes = {
|
||||
@ -14,15 +13,17 @@ export default class MainContent extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.componentDidUpdate();
|
||||
this.timer = setTimeout(() => {
|
||||
document.getElementById(decodeURI(location.hash.replace('#', ''))).scrollIntoView();
|
||||
}, 10);
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
if (!location.hash) {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
} else if (!firstMounted) {
|
||||
this.timer = setTimeout(() => {
|
||||
document.getElementById(decodeURI(location.hash.replace('#', ''))).scrollIntoView();
|
||||
}, 10);
|
||||
}
|
||||
firstMounted = true;
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
@ -17,7 +17,6 @@ window.antd = require('antd');
|
||||
// Polyfill
|
||||
const areIntlLocalesSupported = require('intl-locales-supported');
|
||||
const localesMyAppSupports = ['zh-CN', 'en-US'];
|
||||
|
||||
if (global.Intl) {
|
||||
// Determine if the built-in `Intl` has the locale data we need.
|
||||
if (!areIntlLocalesSupported(localesMyAppSupports)) {
|
||||
@ -49,26 +48,24 @@ export function collect(nextProps, callback) {
|
||||
.then((list) => callback(null, { ...nextProps, components: list }));
|
||||
}
|
||||
|
||||
let gaListenerSetted = false;
|
||||
export default class Layout extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (typeof ga !== 'undefined' && !gaListenerSetted) {
|
||||
if (typeof ga !== 'undefined') {
|
||||
this.context.router.listen((loc) => {
|
||||
window.ga('send', 'pageview', loc.pathname + loc.search);
|
||||
});
|
||||
gaListenerSetted = true;
|
||||
}
|
||||
|
||||
const loadingNode = document.getElementById('ant-site-loading');
|
||||
if (!loadingNode) {
|
||||
return;
|
||||
if (loadingNode) {
|
||||
this.timer = setTimeout(() => {
|
||||
loadingNode.parentNode.removeChild(loadingNode);
|
||||
}, 450);
|
||||
}
|
||||
this.timer = setTimeout(() => {
|
||||
loadingNode.parentNode.removeChild(loadingNode);
|
||||
}, 450);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -76,12 +73,12 @@ export default class Layout extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const props = this.props;
|
||||
const { children, ...restProps } = this.props;
|
||||
return (
|
||||
<IntlProvider locale={appLocale.locale} messages={appLocale.messages}>
|
||||
<div className="page-wrapper">
|
||||
<Header {...props} />
|
||||
{props.children}
|
||||
<Header {...restProps} />
|
||||
{children}
|
||||
<Footer />
|
||||
</div>
|
||||
</IntlProvider>
|
||||
|
Loading…
Reference in New Issue
Block a user