首页 > 其他分享 >前端项目实战壹佰陆拾陆react-admin+material ui-react-admin之Create之disableAuthentication验证用法

前端项目实战壹佰陆拾陆react-admin+material ui-react-admin之Create之disableAuthentication验证用法

时间:2023-08-21 11:38:19浏览次数:39  
标签:const admin Create material react import


我是歌谣 微信公众号关注前端小歌谣

import * as React from 'react';
import {Button,Typography,Box} from '@mui/material';
import { Create, SimpleForm, TextInput, DateInput, required,TopToolbar} from 'react-admin';
const PostCreateActions = () => (
    <TopToolbar>
        {/* Add your custom actions */}
        <Button color="primary">geyao</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>
);

export const RcreateAdd = () => (
    <Create disableAuthentication component="div" actions={<PostCreateActions />} aside={<Aside />}>
        <SimpleForm>
            <TextInput source="name" validate={[required()]} fullWidth />
            <TextInput source="sex" multiline={true} label="Short description" />
            <TextInput source="salary" multiline={true} label="Short description" />
        </SimpleForm>
    </Create>
);

禁用验证 用户未通过身份验证,该组件将自动将用户重定向到登录页面

标签:const,admin,Create,material,react,import
From: https://blog.51cto.com/u_15460007/7172951

相关文章