antd里面的数据源的格式

import React, { Component } from 'react'
import { Table } from 'antd';

export default class index extends Component {
    render() {
        const dataSource = [
            ["微软", 'gh2', 3, 4],
            ['微软', 'gh2', 3, 4],
            ['微软', 'gh2', 3, 4],
            ['微软', 'gh2gh2gh2', 3, 4]
        ];

        const columns = [
            {
                title: '姓名',
                dataIndex: '0',
                key: '0',
            },
            {
                title: '年龄',
                dataIndex: '1',
                key: '1',
            },
            {
                title: '住址',
                dataIndex: '2',
                key: '2',
            },
        ];
        return (
            <div>
                <Table dataSource={dataSource} columns={columns} />
            </div>
        )
    }
}

 

posted on 2021-10-22 10:55  漫思  阅读(163)  评论(0编辑  收藏  举报

导航