material-table edit/delete 按钮改变动作

material-table edit/delete button change action

我在 React js 中使用 material-table https://material-ui.com/components/tables/#material-table

我需要将用户重定向到项目的单独编辑页面。

我不明白如何重定向到编辑页面。

您可以使用文档中提到的 <TableCell> 并可以创建自定义 onClick 方法以在新页面中打开操作。

https://material-ui.com/components/tables/#sorting-amp-selecting

您可以按照文档中的说明使用 "actions" 属性:https://material-table.com/#/docs/features/actions

<MaterialTable
        ...
        actions={[
          {
            icon: 'edit',
            tooltip: 'Edit User',
            onClick: (event, rowData) => alert('You are editing ' + rowData.name)
          },
          {
            icon: 'delete',
            tooltip: 'Delete User',
            onClick: (event, rowData) => confirm('You want to delete ' + rowData.name)
          }
        ]}
      />