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

Categories

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按钮添加点击事件,总有报错,正确写法请大神指教### 问题描述


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...