From 8b9effb98612ee8a00d76d639a5733d12e9ecce6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 13 十一月 2019 22:09:35 +0800 Subject: [PATCH] 2019-11-13 --- src/components/sidemenu/comtableconfig/editable/index.jsx | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/sidemenu/comtableconfig/editable/index.jsx b/src/components/sidemenu/comtableconfig/editable/index.jsx index dabea8c..93ac53f 100644 --- a/src/components/sidemenu/comtableconfig/editable/index.jsx +++ b/src/components/sidemenu/comtableconfig/editable/index.jsx @@ -1,5 +1,5 @@ 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' @@ -94,30 +94,31 @@ { 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 } } @@ -150,14 +151,14 @@ 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 -- Gitblit v1.8.0