antd React 实现可编辑表格(v2)

这里是第二个版本的 

代码如下:

import React from 'react';
import { Form, Table, Input, Space, Button, InputNumber } from 'antd';
import styler from './index.less';
export default function EditTable(props) {
  const [form] = Form.useForm();
  const onFinish = (values) => {
    console.log(values);
  };
  return (
    
{(fields, { add, remove }) => { const rules = [{ required: true, message: '请填充内容!' }]; return (
{ return ( ); }, }, { title: 'age', dataIndex: 'age', key: 'age', render: (_, record) => { return ( ); }, }, { title: 'address', dataIndex: 'address', key: 'address', render: (_, record, index) => { return ( {({ getFieldValue }) => getFieldValue(['table', index, 'name']) === 'yh' ? ( ) : ( ) } ); }, }, { title: '操作', dataIndex: 'action', key: 'action', render: (text, record) => { return ( add()} className="iconfont iconaddData" /> remove(record.name)} className="iconfont icondelete" /> ); }, }, ]} /> ); }} ); }
.edit_table {
  :global {
    .ant-row .ant-form-item {
      margin-bottom: 0px !important;
    }
  }
}

你可能感兴趣的:(工作日常,react.js,javascript,node.js)