React开发(179):ant design table中jsx风格写法

Posted 前端小歌谣

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React开发(179):ant design table中jsx风格写法相关的知识,希望对你有一定的参考价值。

 <Table dataSource={data}>
    <ColumnGroup title="Name">
      <Column title="First Name" dataIndex="firstName" key="firstName" />
      <Column title="Last Name" dataIndex="lastName" key="lastName" />
    </ColumnGroup>
    <Column title="Age" dataIndex="age" key="age" />
    <Column title="Address" dataIndex="address" key="address" />
    <Column
      title="Tags"
      dataIndex="tags"
      key="tags"
      render={tags => (
        <span>
          {tags.map(tag => (
            <Tag color="blue" key={tag}>
              {tag}
            </Tag>
          ))}
        </span>
      )}
    />
const data = [
  {
    key: '1',
    firstName: 'John',
    lastName: 'Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
    tags: ['nice', 'developer'],
  },
  {
    key: '2',
    firstName: 'Jim',
    lastName: 'Green',
    age: 42,
    address: 'London No. 1 Lake Park',
    tags: ['loser'],
  },
  {
    key: '3',
    firstName: 'Joe',
    lastName: 'Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
    tags: ['cool', 'teacher'],
  },
];

以上是关于React开发(179):ant design table中jsx风格写法的主要内容,如果未能解决你的问题,请参考以下文章

React开发(117):ant design 新方式

React开发(165):ant design validateFields

React开发(165):ant design validateFields

React开发(266):ant design customRequest

React开发(253):react项目理解 ant design ancher锚点

React开发(253):react项目理解 ant design ancher锚点