| | |
| | | import React, {Component} from 'react' |
| | | import { Table, Input, Button, Popconfirm, Form } from 'antd' |
| | | import { Table, Input, Button, Popconfirm, Form, Icon } from 'antd' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | |
| | | { |
| | | title: 'ID', |
| | | dataIndex: 'ID', |
| | | width: '35%', |
| | | width: '40%', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: 'Value', |
| | | dataIndex: 'value', |
| | | width: '35%', |
| | | width: '40%', |
| | | editable: true |
| | | }, |
| | | { |
| | | title: 'operation', |
| | | title: '操作', |
| | | align: 'center', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | this.state.dataSource.length >= 1 ? ( |
| | | <Popconfirm title="Sure to delete?" onConfirm={() => this.handleDelete(record.key)}> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}>Delete</span> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | ) : null, |
| | | } |
| | | ] |
| | | |
| | | this.state = { |
| | | dataSource: [], |
| | | count: 0 |
| | | dataSource: props.data, |
| | | count: props.data.length |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({ dataSource: newData }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | if (this.props.data) { |
| | | this.setState({ |
| | | dataSource: this.props.data, |
| | | count: this.props.data.length |
| | | }) |
| | | } |
| | | } |
| | | // UNSAFE_componentWillMount () { |
| | | // if (this.props.data) { |
| | | // this.setState({ |
| | | // dataSource: this.props.data, |
| | | // count: this.props.data.length |
| | | // }) |
| | | // } |
| | | // } |
| | | |
| | | render() { |
| | | const { dataSource } = this.state |