fix some bugs

This commit is contained in:
zuiidea
2017-03-28 20:50:02 +08:00
parent e1a6f41192
commit a5cb3c6fce
8 changed files with 53 additions and 37 deletions
+2 -1
View File
@@ -51,8 +51,9 @@ class DataTable extends React.Component {
sortOrder: sorter.order,
...filters,
},
}, () => {
this.fetch()
})
this.fetch()
}
fetch = () => {
+20 -11
View File
@@ -1,5 +1,6 @@
import React, { PropTypes } from 'react'
import { Breadcrumb, Icon } from 'antd'
import { Link } from 'dva/router'
import styles from './Bread.less'
import { menu } from '../../utils'
@@ -29,16 +30,21 @@ function Bread ({ location }) {
pathNames.push((`-${item}`).hyphenToHump())
}
})
const breads = pathNames.map((item, key) => {
if (!(item in pathSet)) {
item = 'Dashboard'
}
const breadsArray = pathNames.filter(item => (item in pathSet))
const breads = breadsArray.map((item, key) => {
const content = (
<span>{pathSet[item].icon
? <Icon type={pathSet[item].icon} style={{ marginRight: 4 }} />
: ''}{pathSet[item].name}</span>
)
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 key={key}>
{((breadsArray.length - 1) !== key && pathSet[item].clickable)
? <Link to={pathSet[item].path}>
{content}
</Link>
: content}
</Breadcrumb.Item>
)
})
@@ -46,8 +52,11 @@ function Bread ({ location }) {
return (
<div className={styles.bread}>
<Breadcrumb>
<Breadcrumb.Item href="/"><Icon type="home" />
<span>主页</span>
<Breadcrumb.Item >
<Link to="/dashboard">
<Icon type="home" />
<span>Home</span>
</Link>
</Breadcrumb.Item>
{breads}
</Breadcrumb>
+1 -2
View File
@@ -16,7 +16,6 @@ const getMenus = function (menuArray, siderFold, parentPath = '/') {
}
return (
<Menu.Item key={linkTo}>
<Link to={linkTo}>
{item.icon ? <Icon type={item.icon} /> : ''}
{siderFold && topMenus.indexOf(item.key) >= 0 ? '' : item.name}
@@ -48,7 +47,7 @@ function Menus ({ siderFold, darkTheme, location, handleClickNavMenu, navOpenKey
}
changeOpenKeys(nextOpenKeys)
}
// 菜单栏收起时,不能操作openKeys
let menuProps = !siderFold ? {
onOpenChange,
openKeys: navOpenKeys,