物料表:如何为EmptyDataSourceMessage赋予自定义样式

时间:2019-06-25 07:22:28

标签: reactjs material-table

按照以下示例: https://material-table.com/#/docs/features/localization

我想给EmptyDataSourceMessage自定义样式(基本上是我的兴趣所在)。

任何想法我该怎么做?

1 个答案:

答案 0 :(得分:0)

我能够使用render函数中的HTML添加EmptyDataSource消息:

const emailContact = <a href="mailto:myEmailAddressHere">Email Info</a>;
const noResultsMessage = <span>No results were found. Please email {emailContact</span>;

,然后在return方法中添加:

localization={{
    body: {
        emptyDataSourceMessage: noResultsMessage
    }
}}