king
2019-11-13 8b9effb98612ee8a00d76d639a5733d12e9ecce6
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