4

当我单击关闭按钮时,它正在重定向到个人资料页面。但它进入onclose事件部分,它不应该像它一样刷新页面,returns false而是重定向到配置文件页面。

alertify.alert().setting({
                'title': 'Message',
                'label': 'Ok',
                'message': 'You have not yet enabled Appointment on your profile?',
                'onok': function () {
                    document.location.href = "/profile";
                },
                'onclose':function(e){
                   return false;//It should stop redirecting on profile page
                }
            }).show();

错误:当我单击OkClose(X)两个事件都在触发时。

谢谢。

4

2 回答 2

2

利用

 'onclose':(e)=>{
    e.preventDefault();    //It will stop redirecting on profile page
    return false;//
}
于 2018-07-31T07:04:26.103 回答
2

根据文档,alertify这是alert onok 事件的默认功能。

因此,当onok在警报中调用事件时,它会自动调用onclose事件以关闭对话框。

于 2018-07-31T11:30:18.647 回答