前端项目实战玖拾react-admin+material ui-踩坑-List的用法之children用法之WithListContext

我是歌谣 这里是歌谣的前端笔记小屋 想加入前端巅峰人才交流群私信我

import {
List,
BooleanField,
TextField,
Datagrid,
WithListContext
} from 'react-admin';
import IconEvent from '@mui/icons-material/Event';
import { Typography,Stack } from '@mui/material';
const Aside = () => (
<div style={{ width: 200, margin: '1em' }}>
<Typography variant="h6">歌谣</Typography>
<Typography variant="body2">
歌谣不要方
</Typography>
</div>
);
export const RChildrenList = () => {
return (<List resource="t_geyao_person">
{/* <Datagrid>
<TextField source='id'></TextField>
<TextField source='name'></TextField>
<TextField source='sex'></TextField>
<TextField source='salary'></TextField>
<BooleanField source='status'></BooleanField>
</Datagrid> */}
<WithListContext render={({ data }) => (
<Stack spacing={2} sx={{ padding: 2 }}>
{data?.map(book => (
<Typography key={book.id}>
<i>{book.id}</i>, by {book.name} ({book.sex})
</Typography>
))}
</Stack>
)} />
</List>)
}

运行结果

posted @   前端导师歌谣  阅读(5)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示