如何更改右侧面板上 "Resource" 组件的标题文本
How to change the Title text for a "Resource" component on right panel
此 link 解释了更改菜单文本的方法 - https://github.com/marmelab/admin-on-rest/blob/master/docs/Resource.md#options
但我想知道如何更改右侧面板上呈现的文本,即当单击抽屉菜单时。我看到如果我的代码是这样的:
<Resource name="v2/posts" options={{ label: 'Posts' }} list={PostList} />
then the Title is rendered as V2/Posts List. How do I give a custom title ?
您必须为 PostList
组件提供 title
属性,例如
<PostList {...props} title={'Your title'} >
...
或者您可以自定义标题:
<PostList title={<PostTitle />} {...props} >
其中 PostTitle 是:
const PostTitle = ({ record }) => {
return <span>My title</span>;
};
此 link 解释了更改菜单文本的方法 - https://github.com/marmelab/admin-on-rest/blob/master/docs/Resource.md#options
但我想知道如何更改右侧面板上呈现的文本,即当单击抽屉菜单时。我看到如果我的代码是这样的:
<Resource name="v2/posts" options={{ label: 'Posts' }} list={PostList} />
then the Title is rendered as V2/Posts List. How do I give a custom title ?
您必须为 PostList
组件提供 title
属性,例如
<PostList {...props} title={'Your title'} >
...
或者您可以自定义标题:
<PostList title={<PostTitle />} {...props} >
其中 PostTitle 是:
const PostTitle = ({ record }) => {
return <span>My title</span>;
};