Ant Design Pro中EditableProTable中的按钮文字如何修改

How to Change Button Text in the EditableProTable in Ant Design Pro

在使用 Ant design pro 创建 Editable Pro Table 时,我找不到任何更改按钮文本的解决方案。

<EditableProTable
          rowKey="id"
          headerTitle="Add Reciepients"
          maxLength={5}
          recordCreatorProps={{ lang: 'en' }}
          columns={columns}
          request={async () => ({
            data: data,
            total: 3,
            success: true,
          })}
          value={dataSource}
          onChange={setDataSource}
          editable={{
            type: 'multiple',
            editableKeys,
            onSave: async (rowKey, data, row) => {
              console.log(rowKey, data, row);
              await waitTime(2000);
            },
            onChange: setEditableRowKeys,
          }}
        />

要更改按钮文本,您需要使用道具 recordCreatorProps 并设置 creatorButtonText 字段的值:

<EditableProTable
  rowKey="id"
  headerTitle="Add Reciepients"
  maxLength={5}
  recordCreatorProps={{ lang: "en", creatorButtonText: "add row" }}
  columns={columns}
  request={async () => ({
    data: defaultData,
    total: 3,
    success: true
  })}
  value={dataSource}
  onChange={setDataSource}
  editable={{
    type: "multiple",
    editableKeys,
    onSave: async (rowKey, data, row) => {
      console.log(rowKey, data, row);
      await waitTime(2000);
    },
    onChange: setEditableRowKeys
  }}
/>