import * as React from "react";
import {Button,Typography,Box} from '@mui/material';
import { Edit, ListButton,useRecordContext, ShowButton, SimpleForm, TextInput,TopToolbar, DateInput, ReferenceManyField, Datagrid, TextField, DateField, EditButton, required } from 'react-admin';
const PostTitle = () => {
const record = useRecordContext();
return <span>Post {record ? `"${record.name}"` : '1111'}</span>;
};
export const SimpleFormEdit = () => {
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 >
<SimpleForm warnWhenUnsavedChanges>
<TextInput source="name" validate={[required()]} fullWidth />
<TextInput source="sex" multiline={true} label="Short description" />
<TextInput source="salary" multiline={true} label="Short description" />
</SimpleForm>
</Edit>
)
}
前端项目实战贰佰零壹react-admin+material ui-react-admin之warnWhenUnsavedChanges
最新推荐文章于 2024-08-22 17:38:39 发布