如何在"react-admin"“显示"菜单中设置更复杂的布局?和“修改"和“创建"屏幕? [英] How do I have more complex layouts in `react-admin` "Show" and "Edit" and "Create" screens?

查看:56
本文介绍了如何在"react-admin"“显示"菜单中设置更复杂的布局?和“修改"和“创建"屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以react-admin为基础.基本结构是这样:

I'm trying to build on react-admin. The base structure is this:

<Show {...props} >
  <SimpleShowLayout>
    <TextField source="id" />
    <TextField source="name" />
  </SimpleShowLayout>
</Show>

我正在做这样的事情:

<Show {...props} >
  <div className="row">
    <div className="col-sm-6">
      <TextField source="id" />
    </div>
    <div className="col-sm-6">
      <TextField source="name" />
    </div>
  </div>
</Show>

推荐答案

我们需要更新我们的文档.我们最近将组件与逻辑解耦,即在 ra-core 包中将XXXController(ListController,CreateController等)命名为,在 ra-ui-中将UI组件(List,Create等)命名为逻辑materialui 程序包由控制器控制.

We need to update our documentation about this. We recently decoupled components with logic, that we name XXXController (ListController, CreateController, etc) in the ra-core package and UI components (List, Create, etc) in the ra-ui-materialui package which the controllers.

react-admin 包考虑为带有material-ui UI的react-admin分发版.如果需要大量定制,则可以直接使用控制器.

Think about the react-admin package as a distribution of react-admin with material-ui UI. When heavy customization is needed, you can use the controllers directly.

现在,您必须浏览源代码以完全了解如何使用它们.

For now, you'll have to explore the source code to fully understand how to use them.

这是一个例子:

import { ShowController, ShowView, SimpleShowLayout, TextField } from 'react-admin';

const UserShow = props => (
    <ShowController {...props}>
        {controllerProps => 
            // You're on your own here
        }
    </ShowController>
);

这篇关于如何在"react-admin"“显示"菜单中设置更复杂的布局?和“修改"和“创建"屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆