Antd:如何更改 table 分拣机上的工具提示标签

Antd: How to change tooltip label on table sorter

我是 Antd 的新手,我创建了一个具有排序功能的 table,但我需要更改排序器工具提示上的文本。

排序工具提示:-

提前致谢,如果您需要任何额外的代码片段,请告诉我。

根据文档,表格使用实现工具提示的排序器 object。

您可以在此处找到有关 Table API 的更多信息:https://ant.design/components/table/

还有更多关于工具提示 API 的信息:https://ant.design/components/tooltip/#API

本质上,您需要将 yourTable.showSorterTooltip 属性 设置为包含所需属性的 object。看起来您要查找的特定 属性 只是“标题”,但您可以在工具提示 API

中看到完整的属性列表

我是这样解决的:

<Table showSorterTooltip={{ title: 'Clic para ordenar' }}
       columns={tableColumn}
       dataSource={item}
       rowClassName='ps-pointer'
       rowKey={record => record.codigo_pedido_compra}
       style={{ cursor: 'pointer' }}
  />

诀窍是使用 showSorterTooltip 属性。

根据 github 中的 this 问题,您可以将 Table 的 locale 属性 设置为您想要的

<Table 
      locale={{ 
          triggerDesc: 'descend sort text',
          triggerAsc: 'ascend sort text', 
          cancelSort: 'cancel sort text'
      }}
   />