dy-router

This commit is contained in:
zuiidea
2016-12-28 00:10:24 +08:00
parent 6b108497cc
commit 6af4dc9303
2 changed files with 16 additions and 17 deletions
+10 -13
View File
@@ -32,20 +32,17 @@ function Bread({ location }) {
}
})
const breads = pathNames.map((item, key) => {
if (item=='-'){
return <Breadcrumb.Item key={key}>
无
</Breadcrumb.Item>
}else {
return (
<Breadcrumb.Item key={key} {...((pathNames.length - 1 == key)||!pathSet[item].clickable)? '' : { href: '#' + pathSet[item].path }}>
{pathSet[item].icon
? <Icon type={pathSet[item].icon} />
: ''}
<span>{pathSet[item].name}</span>
</Breadcrumb.Item>
)
if(item=='-'){
item='Dashboard'
}
return (
<Breadcrumb.Item key={key} {...((pathNames.length - 1 == key)||!pathSet[item].clickable)? '' : { href: '#' + pathSet[item].path }}>
{pathSet[item].icon
? <Icon type={pathSet[item].icon} />
: ''}
<span>{pathSet[item].name}</span>
</Breadcrumb.Item>
)
})
return (
+6 -4
View File
@@ -1,7 +1,6 @@
import React from 'react'
import {Router} from 'dva/router'
import App from './routes/app'
import Error from './routes/error'
export default function ({history, app}) {
@@ -9,9 +8,12 @@ export default function ({history, app}) {
{
path: '/',
component: App,
// IndexRoute:{
// component: Error,
// },
getIndexRoute(nextState, cb) {
require.ensure([], require => {
app.model(require('./models/dashboard'))
cb(null, {component: require('./routes/dashboard')})
})
},
childRoutes: [
{
path: 'dashboard',