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

import {
    List,
    BooleanField,
    TextField,
    Datagrid,
    WithListContext,
    SimpleList
} 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>
        )} /> */}
        <SimpleList 
           primaryText={record => <i>record.id</i>}
          secondaryText={record => <>By {record.name} ({record.sex})</>}
     />
    </List>)
}

 运行结果

 

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