/
_app.js
58 lines (52 loc) · 1.72 KB
/
_app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { Fragment } from 'react';
import App, { Container } from 'next/app';
import Head from 'next/head';
import { Provider } from 'react-redux';
import withRedux from 'next-redux-wrapper';
import withReduxSaga from 'next-redux-saga';
import createStore from '../redux/store';
import NoLayout from '../components/NoLayout';
import '../assets/self-styles.less';
import { RouterTitle } from '../constants/ConstTypes';
import "antd/dist/antd.less";
import {withRouter} from 'next/router';
class NextApp extends App {
static async getInitialProps ({ Component, ctx }) {
let pageProps = {};
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps({ ctx });
}
return { pageProps };
}
render () {
const { Component, pageProps, store, router } = this.props;
return (
<Fragment>
<Head>
<meta name='viewport' content='width=device-width, initial-scale=1' />
<meta charSet='utf-8' />
<title>Nobibi-next</title>
<link rel='shortcut icon' href='/static/favicon.ico' type='image/ico'/>
<style jsx global>{`
* {
margin: 0;
padding: 0;
}
body {
font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif;
}
`}
</style>
</Head>
<Container>
<Provider store={store}>
<NoLayout title={RouterTitle[router.pathname]}>
<Component {...pageProps} router={router} />
</NoLayout>
</Provider>
</Container>
</Fragment>
);
}
}
export default withRedux(createStore)(withReduxSaga({ async: true })(withRouter(NextApp)));