From 64c152fb2daa154861b2ef5827cd1fbbaea3a1c0 Mon Sep 17 00:00:00 2001 From: zuiidea Date: Fri, 10 Feb 2017 16:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=93=8D=E4=BD=9C=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/users/list.js | 47 +++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/components/users/list.js b/src/components/users/list.js index 23e4247..4a9150b 100644 --- a/src/components/users/list.js +++ b/src/components/users/list.js @@ -1,7 +1,8 @@ import React from 'react' -import {Table, Popconfirm} from 'antd' +import {Table, Dropdown, Button, Menu, Icon, Modal} from 'antd' import {TweenOneGroup} from 'rc-tween-one' import styles from './list.less' +const confirm = Modal.confirm class list extends React.Component { constructor (props) { @@ -56,19 +57,26 @@ class list extends React.Component { ) } + handleMenuClick = (record, e) => { + const {onDeleteItem, onEditItem} = this.props + if (e.key === '1') { + onEditItem(record) + } else if (e.key === '2') { + confirm({ + title: '您确定要删除这条记录吗?', + onOk () { + onDeleteItem(record.id) + } + }) + } + } + onEnd = (e) => { e.target.style.height = 'auto' } render () { - const { - loading, - dataSource, - pagination, - onPageChange, - onDeleteItem, - onEditItem - } = this.props + const {loading, dataSource, pagination, onPageChange} = this.props const columns = [ { title: '头像', @@ -117,16 +125,17 @@ class list extends React.Component { title: '操作', key: 'operation', width: 100, - render: (text, record) => ( -

- onEditItem(record)} style={{ - marginRight: 4 - }}>编辑 - onDeleteItem(record.id)}> - 删除 - -

- ) + render: (text, record) => { + return ( + 编辑 + 删除 + }> + + ) + } } ] const self = this