main layout

This commit is contained in:
zuiidea
2016-10-14 00:26:36 +08:00
parent 0119dfdc2a
commit 1a3ea0f244
4 changed files with 22 additions and 26 deletions
+10 -6
View File
@@ -1,15 +1,19 @@
import React from 'react'
import { Router, Route } from 'dva/router'
import Index from './routes/index'
import { Router, Route , IndexRedirect , hashHistory} from 'dva/router'
import App from './components/layout/main'
import NotFound from './routes/NotFound'
import Dashboard from './routes/dashboard'
import Users from './routes/users'
export default function ({ history }) {
return (
<Router history={history}>
<Route path="/" component={Index} />
<Route path="/users" component={Users} />
<Route path="*" component={NotFound} />
<Router history={ history }>
<Route path="/" component={ App } >
<IndexRedirect to="/dashboard" />
<Route path="dashboard" component={Dashboard}/>
<Route path="/users" component={ Users } />
<Route path="*" component={ NotFound } />
</Route>
</Router>
)
}
+5 -7
View File
@@ -86,13 +86,11 @@ function Users({ location, dispatch, users }) {
<UserModal {...userModalProps} />
return (
<Main location={location}>
<div className={styles.normal}>
<UserSearch {...userSearchProps} />
<UserList {...userListProps} />
<UserModalGen />
</div>
</Main>
<div className={styles.normal}>
<UserSearch {...userSearchProps} />
<UserList {...userListProps} />
<UserModalGen />
</div>
)
}
@@ -1,8 +1,9 @@
import React from 'react'
import React, { PropTypes } from 'react'
import { Link } from 'dva/router'
import styles from './Index.less'
import Main from '../components/layout/main'
import styles from './app.less'
function HomePage() {
function Dashboard() {
return (
<div className={styles.normal}>
<h1>Hello Antd.</h1>
@@ -14,7 +15,8 @@ function HomePage() {
)
}
HomePage.propTypes = {
Dashboard.propTypes = {
location: PropTypes.object,
}
export default HomePage
export default Dashboard
-8
View File
@@ -1,8 +0,0 @@
.normal {
margin: 100px;
}
.list {
margin-top: 20px;
}