简体   繁体   English

如何在 react-admin 中自定义每个页面的标题

[英]How to change the title on each page custom in react-admin

I want to change the title on each page to custom in React-Admin Is there a specific property in the Recorse or list or edit or create composites?我想在 React-Admin 中将每个页面上的标题更改为自定义 Recorse 或列表或编辑或创建复合材料中是否有特定属性? please guide me Thanks请指导我谢谢

enter image description here在此处输入图像描述

List, Show, Create and Update components all accept title prop, it can be either a string, or an element of your own. List、Show、Create 和 Update 组件都接受 title 属性,它可以是字符串,也可以是您自己的元素。

<List {...props} title="My custom title">
    ...
</List>

or或者

const PostTitle = props => {
    return <span>Post {props.record ? `"${props.record.title}"` : ''}</span>;
};

export const PostShow = (props) => (
    <Show title={<PostTitle />} {...props}>
        ...
    </Show>
);

If you wanna change the name in the menu, you can pass options prop with label to Resource:如果要更改菜单中的名称,可以将带有 label 的 options 属性传递给资源:

<Resource ... options={{label: "Custom menu name"}}>

For multillingual apps, this is accomplished with the i18nProvider prop on Admin对于多语言应用程序,这是通过 Admin 上的 i18nProvider 属性完成的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM