forked from yanlele/node-index
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
53 lines (48 loc) · 1.28 KB
/
index.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
import React from 'react'
import ReactDom from 'react-dom'
import {createStore, applyMiddleware, compose} from 'redux'
import thunk from 'redux-thunk'
import {Provider} from 'react-redux'
import {
BrowserRouter,
Route,
Redirect,
Switch
} from 'react-router-dom'
import reducers from './reducer'
import Auth from './Auth.js'
import Dashboard from './Dashboard'
import './config'
import 'antd-mobile/dist/antd-mobile.css';
const store = createStore(reducers, compose(
applyMiddleware(thunk),
window.devToolsExtension ? window.devToolsExtension() : f => f
))
// class Test extends React.Component{
// constructor(props) {
// super(props)
// }
// render(){
// console.log(this.props)
// return <h2>测试组件 {this.props.match.params.location}</h2>
// }
// }
// 登录
// 没有登录信息 统一跳转login
// 页面 导航+显示+注销
// 一营
// 二营
// 骑兵连
// router+redux
ReactDom.render(
(<Provider store={store}>
<BrowserRouter>
<Switch>
<Route path='/login' component={Auth}></Route>
<Route path='/dashboard' component={Dashboard}></Route>
<Redirect to='/dashboard'></Redirect>
</Switch>
</BrowserRouter>
</Provider>),
document.getElementById('root')
)