自己创建的组件:代码
<pre class="has">
import { Table,Divider,Tag } from 'antd';
import React,{ Component } from 'react';
export default class My_Table extends Component {
render() {
const columns = [{
title: 'Name',dataIndex: 'name',key: 'name',render: text => <a href="javascript:;">{text},},{
title: 'Tags',key: 'tags',dataIndex: 'tags',render: tags => (
{tags.map(tag =>
),{
title: 'Action',key: 'action',render: (text,record) => (
<a href="javascript:;">Invite {record.name}
const data = [{
key: '1',name: 'John Brown',age: 32,address: 'New York No. 1 Lake Park',tags: ['nice','developer'],{
key: '2',name: 'Jim Green',age: 42,address: 'London No. 1 Lake Park',tags: ['loser'],}];
return(<Table columns={columns} dataSource={data} />);
}
}
<pre class="has">
import React,{ Component } from 'react';
import My_Table from './list_detail';
export default class import_test extends Component {
render() {
return(<My_Table/>);
}
}