<a className={"deleteProject"} onClick={() => this.showDeleteConfirm(record.id)}>删除</a>
//按钮的oClick事件调用此函数
showDeleteConfirm = (id) => {
    Modal.confirm({
        title: '确认删除此项目吗?',
        icon: <ExclamationCircleOutlined/>,
        content: '',
        okText: '',
        okType: 'danger',
        cancelText: '',
        onOk: () => {
            this.handleOk(id)//确认按钮的回调方法,在下面
        }
        ,
        onCancel() {
            console.log('Cancel');
        },
    });
};

//删除的弹出框的确认按钮,执行删除操作
handleOk = (id) => {
    let params = {id: id};
    fetchPost(global.constants.deleteProject【此处填写自己后端接口url】, params).then(
        res => this.setData(res)
    ).catch(e => console.log(e))
        .finally(() => {
            this.setState({
                requestLoading: false
            })
        });
};

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2021-11-09
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-11-28
相关资源
相似解决方案