赞
踩
Modal组件自身带有footer属性,
在嵌入form表单时候,是否需要加入表单的buttn按钮呢?
如果我们加入form表单内按钮,那么就需要隐藏Modal的footer属性,同时在Modal里面需要调整按钮的样式,来配合Modal。这样在操作表单的时候,只需要在对应的Form.Item设置校验规则,不用另外添加代码,就可以完成校验的工作。
另一个就是我们直接使用Modal组件的footer的按钮,不用调整哪些繁琐的样式了,但是操作Modalfooter按钮的时候不能直接校验Form表单,以下是解决该问题的源码:
- <Modal
- title={intl.formatMessage({ id: "frame.change_pwd" })}
- visible={visible}
- width='400px'
- onOk={onChangePwd}
- onCancel={() => {
- onCancel();
- form.resetFields();
- }}
- okText={intl.formatMessage({ id: 'common.confirm' })}
- cancelText={intl.formatMessage({ id: 'common.cancel' })}
- destroyOnClose={tru
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。