简体   繁体   中英

how can i close modal after form submitting gives an error?

this is my modal component,

it closes after submit success, but stays on the page if submit fails

I use the redux form and ant design

Modal.confirm({
  title: title
  content:delete
  okText: yes
  cancelText: no
  okType: 'danger',
  onOk: () => {
      this.props.delete(this.props.id);
  },
});

Try this below:

Modal.confirm({
  title: title
  content:delete
  okText: yes
  cancelText: no
  okType: 'danger',
  onOk: () => {
      this.props.delete(this.props.id);
  },
  onCancel() {
  console.log('Cancel'); -------> Your desired Event 
 },
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM