我是歌谣 微信公众号关注前端小歌谣进入前端巅峰人才交流群
import * as React from "react";
import {Button,Typography,Box} from '@mui/material';
import { Edit, ListButton, ShowButton, SimpleForm, TextInput,TopToolbar, DateInput, ReferenceManyField, Datagrid, TextField, DateField, EditButton, required } from 'react-admin';
export const ReditEdit = () => {
const PostEditActions = () => (
<TopToolbar>
<ShowButton />
{/* Add your custom actions */}
<ListButton />
<Button color="primary" >Custom Action</Button>
</TopToolbar>
);
const Aside = () => (
<Box sx={{ width: '200px', margin: '1em' }}>
<Typography variant="h6">Instructions</Typography>
<Typography variant="body2">
Posts will only be published once an editor approves them
</Typography>
</Box>
);
return(
<Edit aside={<Aside />} actions={<PostEditActions />}>
<SimpleForm>
<TextInput source="name" validate={[required()]} fullWidth />
<TextInput source="sex" multiline={true} label="Short description" />
<TextInput source="salary" multiline={true} label="Short description" />
</SimpleForm>
</Edit>
)
}
运行结果