mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 19:42:54 +08:00
site: fix
This commit is contained in:
parent
f99a77b3e5
commit
5be40a9c7f
@ -126,7 +126,7 @@
|
||||
"clean": "antd-tools run clean",
|
||||
"start": "bisheng start -c ./site/bisheng.config.js",
|
||||
"site": "bisheng build -c ./site/bisheng.config.js",
|
||||
"pre-deploy": "cp CNAME _site",
|
||||
"pre-deploy": "mkdir -p _site && cp CNAME _site",
|
||||
"deploy": "tnpm run clean && tnpm i && tnpm run just-deploy",
|
||||
"just-deploy": "tnpm run pre-deploy && bisheng gh-pages -c ./site/bisheng.config.js",
|
||||
"lint": "npm run srclint && npm run demolint && npm run lesshint",
|
||||
|
@ -9,6 +9,13 @@ import Page3 from './Page3';
|
||||
import Page4 from './Page4';
|
||||
|
||||
export default class Home extends React.Component {
|
||||
componentWillMount() {
|
||||
if (location.hash) {
|
||||
const pathname = location.hash.replace(/^#/, '').replace('?scrollTo=', '#');
|
||||
location.href = pathname;
|
||||
}
|
||||
}
|
||||
|
||||
// To store style which is only for Home and has conflicts with others.
|
||||
getStyle() {
|
||||
return `
|
||||
|
@ -22,10 +22,6 @@ if (!location.port) {
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-72788897-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
appHistory.listen((loc) => {
|
||||
ga('send', 'pageview', loc.pathname + loc.search);
|
||||
});
|
||||
/* eslint-enable */
|
||||
}
|
||||
|
||||
@ -58,14 +54,31 @@ const isZhCN = (typeof localStorage !== 'undefined' && localStorage.getItem('loc
|
||||
const appLocale = isZhCN ? cnLocale : enLocale;
|
||||
addLocaleData(appLocale.data);
|
||||
|
||||
export default (props) => {
|
||||
return (
|
||||
<IntlProvider locale={appLocale.locale} messages={appLocale.messages}>
|
||||
<div className="page-wrapper">
|
||||
<Header {...props} />
|
||||
{props.children}
|
||||
<Footer />
|
||||
</div>
|
||||
</IntlProvider>
|
||||
);
|
||||
};
|
||||
let gaListenerSetted = false;
|
||||
export default class Layout extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (typeof ga !== 'undefined' && !gaListenerSetted) {
|
||||
this.context.router.listen((loc) => {
|
||||
window.ga('send', 'pageview', loc.pathname + loc.search);
|
||||
});
|
||||
gaListenerSetted = true;
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const props = this.props;
|
||||
return (
|
||||
<IntlProvider locale={appLocale.locale} messages={appLocale.messages}>
|
||||
<div className="page-wrapper">
|
||||
<Header {...props} />
|
||||
{props.children}
|
||||
<Footer />
|
||||
</div>
|
||||
</IntlProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user