需要在一列中加入 2 个按钮
Need to join 2 buttons in a column
我想在一列中显示 2 个按钮,如下图所示
column = [
{
title: 'operation',
dataIndex: 'operation',
render: (_, record) =>
const editable = isEditing(record);
return editable ? (
<span>
<a onClick={cancel} >Cancel</a>
</span>
) : (
<Typography.Link onClick={() => edit(record)}>
Edit
</Typography.Link>
);
state.dataSource.length >= 1 ? (
<Popconfirm title="Sure want to remove?" onConfirm={() => handleDelete(record.key)}>
<a>Remove</a>
</Popconfirm>
) : null,
},]
我试过了..但是代码本身有错误..如何显示2个按钮?我正在使用蚂蚁 Table
基本上,您在 'render' 属性 列对象中 return 的内容将呈现在 table 的列中。
column = [
{
title: 'operation',
dataIndex: 'operation',
render: (_, record) => { //---------------------> missing { in your code
const editable = isEditing(record);
return editable ? (
<span>
<a onClick={cancel} >Cancel</a>
</span>
) : (
<div>
<Typography.Link onClick={() => edit(record)}>
Edit
</Typography.Link>
<Typography.Link onClick={() => delete(record)}> //---> here you put delete btn
Delete
</Typography.Link>
</div>
);
}
},]
我想在一列中显示 2 个按钮,如下图所示
column = [
{
title: 'operation',
dataIndex: 'operation',
render: (_, record) =>
const editable = isEditing(record);
return editable ? (
<span>
<a onClick={cancel} >Cancel</a>
</span>
) : (
<Typography.Link onClick={() => edit(record)}>
Edit
</Typography.Link>
);
state.dataSource.length >= 1 ? (
<Popconfirm title="Sure want to remove?" onConfirm={() => handleDelete(record.key)}>
<a>Remove</a>
</Popconfirm>
) : null,
},]
我试过了..但是代码本身有错误..如何显示2个按钮?我正在使用蚂蚁 Table
基本上,您在 'render' 属性 列对象中 return 的内容将呈现在 table 的列中。
column = [
{
title: 'operation',
dataIndex: 'operation',
render: (_, record) => { //---------------------> missing { in your code
const editable = isEditing(record);
return editable ? (
<span>
<a onClick={cancel} >Cancel</a>
</span>
) : (
<div>
<Typography.Link onClick={() => edit(record)}>
Edit
</Typography.Link>
<Typography.Link onClick={() => delete(record)}> //---> here you put delete btn
Delete
</Typography.Link>
</div>
);
}
},]