【问题标题】:React-confirm-bootstrap - Is there an 'onCancel' method?React-confirm-bootstrap - 是否有“onCancel”方法?
【发布时间】:2017-11-06 13:40:51
【问题描述】:

我正在使用 react-confirm-bootstrap 模式来显示确认框,但我无法处理“取消”选项。如果用户选择取消,我想做点什么。有没有类似onConfirmonCancel方法?或者我该如何处理?

var Confirm = require('react-confirm-bootstrap');

var ConfirmAction = React.createClass({
    onConfirm() {
        // Preform your action.
    },

    render() {
        return (
            <Confirm
                onConfirm={this.onConfirm}
                body="Are you sure you want to delete this?"
                confirmText="Confirm Delete"
                title="Deleting Stuff">
                <button>Delete Stuff</button>
            </Confirm>
        )
    },
});

【问题讨论】:

    标签: reactjs confirm


    【解决方案1】:

    onClose: React.PropTypes.func

    关闭后调用的函数。

    var ConfirmAction = React.createClass({
        onConfirm() {
           // Preform your action.
        },
        afterClose() {
          // you code after close
        },
    
    
        render() {
            return (
                <Confirm
                    onConfirm={this.onConfirm}
                    body="Are you sure you want to delete this?"
                    confirmText="Confirm Delete"
                    title="Deleting Stuff">
                    onClose={this.afterClose}
                    <button>Delete Stuff</button>
                </Confirm>
            )
        },
    });
    

    【讨论】:

      猜你喜欢
      • 2017-11-17
      • 2020-12-18
      • 2019-11-25
      • 2022-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-15
      • 1970-01-01
      相关资源
      最近更新 更多