index.js 686 Bytes
Newer Older
1
import '@babel/polyfill';
2
import dva from 'dva';
jim's avatar
jim committed
3

Andreas Cederström's avatar
Andreas Cederström committed
4
import createHistory from 'history/createHashHistory';
jim's avatar
jim committed
5 6
// user BrowserHistory
// import createHistory from 'history/createBrowserHistory';
Andreas Cederström's avatar
Andreas Cederström committed
7
import createLoading from 'dva-loading';
8
import 'moment/locale/zh-cn';
afc163's avatar
afc163 committed
9
import FastClick from 'fastclick';
偏右's avatar
偏右 committed
10
import './rollbar';
陈帅's avatar
陈帅 committed
11
import onError from './error';
Andreas Cederström's avatar
Andreas Cederström committed
12

13 14 15
import './index.less';
// 1. Initialize
const app = dva({
Andreas Cederström's avatar
Andreas Cederström committed
16
  history: createHistory(),
陈帅's avatar
陈帅 committed
17
  onError,
18 19 20
});

// 2. Plugins
Andreas Cederström's avatar
Andreas Cederström committed
21
app.use(createLoading());
22

WhatAKitty's avatar
WhatAKitty committed
23
// 3. Register global model
24
app.model(require('./models/global').default);
25 26

// 4. Router
27
app.router(require('./router').default);
28 29 30

// 5. Start
app.start('#root');
afc163's avatar
afc163 committed
31
FastClick.attach(document.body);