Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

antd table怎么实现点击详情按钮弹出详情内容,不是点击一行

antd table怎么实现点击详情按钮弹出详情内容,不是点击一行
`const columns: ColumnProps<any>[] = [

{ title: 'Id', width: 100, dataIndex: 'key', key: 'key', fixed: 'left' },
{ title: 'Full Name', dataIndex: 'name', key: 'name' },
{ title: 'Age', dataIndex: 'age', key: 'age' },
{
    title: 'Action',
    key: 'operation',
    fixed: 'right',
    width: 100,
    render: (text: any, record: any) => (
        <Button>Action 一 {record.key}</Button>
    ),
},

];`

react新手,尝试各种button按钮添加点击事件,总有报错,正确写法请大神指教### 问题描述


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

其实和你的差不多,就给button一个点击事件

{
    title: 'Action',
    key: 'operation',
    fixed: 'right',
    width: 100,
    render: (text: any, record: any) => (
        <Button onClick={() => this.onOpenDetailsDialog(record.id)}>详情</Button>
    ),
},

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...