mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-28 20:03:57 +00:00
add:ui-components
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import React, {PropTypes} from 'react'
|
||||
import {Dropdown, Button, Icon, Menu} from 'antd'
|
||||
|
||||
const DropOption = ({onMenuClick, menuOptions = [], buttonStyle, dropdownProps}) => {
|
||||
const menu = menuOptions.map(item => <Menu.Item key={item.key}>{item.name}</Menu.Item>)
|
||||
return <Dropdown overlay={<Menu onClick={onMenuClick} {...dropdownProps}>
|
||||
{menu}
|
||||
</Menu>}>
|
||||
<Button style={{ border: 'none', ...buttonStyle}}>
|
||||
<Icon style={{ marginRight: 2 }} type='bars' />
|
||||
<Icon type='down' />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
}
|
||||
|
||||
DropOption.propTypes = {
|
||||
onMenuClick: PropTypes.func,
|
||||
menuOptions: PropTypes.array.isRequired,
|
||||
buttonStyle: PropTypes.object,
|
||||
dropdownProps: PropTypes.object
|
||||
}
|
||||
|
||||
export default DropOption
|
||||
@@ -1,4 +1,5 @@
|
||||
import Ico from './ico.js'
|
||||
import Search from './search.js'
|
||||
import DropOption from './dropOption.js'
|
||||
|
||||
export { Ico, Search }
|
||||
export { Ico, Search, DropOption }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, {PropTypes} from 'react'
|
||||
import {Table, Dropdown, Button, Menu, Icon, Modal} from 'antd'
|
||||
import {Table, Modal} from 'antd'
|
||||
import styles from './list.less'
|
||||
import classnames from 'classnames'
|
||||
import TableBodyWrapper from '../common/TableBodyWrapper'
|
||||
import {DropOption} from '../ui/index'
|
||||
|
||||
const confirm = Modal.confirm
|
||||
|
||||
@@ -69,15 +70,7 @@ function list ({ loading, dataSource, pagination, onPageChange, onDeleteItem, on
|
||||
key: 'operation',
|
||||
width: 100,
|
||||
render: (text, record) => {
|
||||
return (<Dropdown overlay={<Menu onClick={(e) => handleMenuClick(record, e)}>
|
||||
<Menu.Item key='1'>编辑</Menu.Item>
|
||||
<Menu.Item key='2'>删除</Menu.Item>
|
||||
</Menu>}>
|
||||
<Button style={{ border: 'none' }}>
|
||||
<Icon style={{ marginRight: 2 }} type='bars' />
|
||||
<Icon type='down' />
|
||||
</Button>
|
||||
</Dropdown>)
|
||||
return <DropOption onMenuClick={e => handleMenuClick(record, e)} menuOptions={[{key: '1', name: '编辑'}, {key: '2', name: '删除'}]} />
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user