【问题标题】:The style api is not working in antd modals样式 api 在 antd modals 中不起作用
【发布时间】:2021-09-18 15:01:17
【问题描述】:

style={{ top: '20' }} - 这似乎不起作用。我该怎么办。所有其他 antd 功能都可以正常工作。

const LoginModal = ({ showModal, setShowModal }) => {
    //const [form] = Form.useForm();
    const onFinish = (values) => {
      console.log('Received values of form: ', values);
    };

return (

<Modal
  title="Sign In"
  **style={{ top: '20' }}**
  visible={showModal}
  onCancel={() => setShowModal(!showModal)}
  width={500}
>

  <h1>Welcome Back !</h1>
 <Form
  name="normal_login"
  className="login-form"
  initialValues={{
    remember: true,
  }}
  onFinish={onFinish}
>

【问题讨论】:

    标签: reactjs react-redux antd


    【解决方案1】:

    使用此样式

    import { makeStyles } from '@material-ui/core'
    
    const useStyles = makeStyles((theme) => ({
    modalStyle:{
          marginTop:theme.Spacing(5);
               }
    }));
    
    const classes = useStyles();
    return(
           className={classes.modalStyle}
           )
    

    【讨论】:

      猜你喜欢
      • 2019-09-01
      • 1970-01-01
      • 2021-11-20
      • 2016-05-30
      • 2019-11-23
      • 1970-01-01
      • 2011-03-15
      • 2013-11-28
      • 2018-10-18
      相关资源
      最近更新 更多