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