1
1
import React from 'react' ;
2
2
import ReactDOM from 'react-dom' ;
3
- import App from './App' ;
4
3
import './index.css' ;
5
4
import './style/lib/animate.css' ;
6
- import { Router , Route , hashHistory , IndexRedirect } from 'react-router' ;
7
- import Page from './components/Page' ;
8
- import BasicForm from './components/forms/BasicForm' ;
9
- import BasicTable from './components/tables/BasicTables' ;
10
- import AdvancedTable from './components/tables/AdvancedTables' ;
11
- import AsynchronousTable from './components/tables/AsynchronousTable' ;
12
- import Login from './components/pages/Login' ;
13
- import Echarts from './components/charts/Echarts' ;
14
- import Recharts from './components/charts/Recharts' ;
15
- import Icons from './components/ui/Icons' ;
16
- import Buttons from './components/ui/Buttons' ;
17
- import Spins from './components/ui/Spins' ;
18
- import Modals from './components/ui/Modals' ;
19
- import Notifications from './components/ui/Notifications' ;
20
- import Tabs from './components/ui/Tabs' ;
21
- import Banners from './components/ui/banners' ;
22
- import Drags from './components/ui/Draggable' ;
23
- import Dashboard from './components/dashboard/Dashboard' ;
24
- import Gallery from './components/ui/Gallery' ;
25
- import NotFound from './components/pages/NotFound' ;
26
- import BasicAnimations from './components/animation/BasicAnimations' ;
27
- import ExampleAnimations from './components/animation/ExampleAnimations' ;
28
5
import registerServiceWorker from './registerServiceWorker' ;
29
6
import { Provider } from 'react-redux' ;
30
7
import thunk from 'redux-thunk' ;
31
8
import { createStore , applyMiddleware } from 'redux' ;
32
9
import reducer from './reducer' ;
33
- import AuthBasic from './components/auth/Basic' ;
34
- import RouterEnter from './components/auth/RouterEnter' ;
35
10
36
- const Wysiwyg = ( ___location , cb ) => { // 按需加载富文本配置
37
- require . ensure ( [ ] , require => {
38
- cb ( null , require ( './components/ui/Wysiwyg' ) . default ) ;
39
- } , 'Wysiwyg' ) ;
40
- } ;
11
+ import CRouter from './routes' ;
41
12
42
- const routes =
43
- < Route path = { '/' } components = { Page } >
44
- < IndexRedirect to = "/app/dashboard/index" />
45
- < Route path = { 'app' } component = { App } >
46
- < Route path = { 'form' } >
47
- < Route path = { 'basicForm' } component = { BasicForm } />
48
- </ Route >
49
- < Route path = { 'table' } >
50
- < Route path = { 'basicTable' } component = { BasicTable } />
51
- < Route path = { 'advancedTable' } components = { AdvancedTable } />
52
- < Route path = { 'asynchronousTable' } components = { AsynchronousTable } />
53
- </ Route >
54
- < Route path = { 'chart' } >
55
- < Route path = { 'echarts' } component = { Echarts } />
56
- < Route path = { 'recharts' } component = { Recharts } />
57
- </ Route >
58
- < Route path = { 'ui' } >
59
- < Route path = { 'icons' } component = { Icons } />
60
- < Route path = { 'buttons' } component = { Buttons } />
61
- < Route path = { 'spins' } component = { Spins } />
62
- < Route path = { 'modals' } component = { Modals } />
63
- < Route path = { 'notifications' } component = { Notifications } />
64
- < Route path = { 'tabs' } component = { Tabs } />
65
- < Route path = { 'banners' } component = { Banners } />
66
- < Route path = { 'wysiwyg' } getComponent = { Wysiwyg } />
67
- < Route path = { 'drags' } component = { Drags } />
68
- < Route path = { 'gallery' } component = { Gallery } />
69
- </ Route >
70
- < Route path = { 'animation' } >
71
- < Route path = { 'basicAnimations' } component = { BasicAnimations } />
72
- < Route path = { 'exampleAnimations' } component = { ExampleAnimations } />
73
- </ Route >
74
- < Route path = { 'dashboard/index' } component = { Dashboard } />
75
- < Route path = "auth" >
76
- < Route path = "basic" component = { AuthBasic } />
77
- < Route path = "routerEnter" component = { RouterEnter } />
78
- </ Route >
79
- </ Route >
80
- < Route path = { 'login' } components = { Login } />
81
- < Route path = { '404' } component = { NotFound } />
82
- </ Route > ;
83
13
84
14
// redux 注入操作
85
15
const middleware = [ thunk ] ;
@@ -88,9 +18,7 @@ console.log(store.getState());
88
18
89
19
ReactDOM . render (
90
20
< Provider store = { store } >
91
- < Router history = { hashHistory } >
92
- { routes }
93
- </ Router >
21
+ < CRouter store = { store } />
94
22
</ Provider >
95
23
,
96
24
document . getElementById ( 'root' )
0 commit comments