Skip to content

Commit 8c05f03

Browse files
moyusxxyan0205
authored andcommitted
fix(dialog): add cancel callback
1 parent ac0770a commit 8c05f03

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

components/dialog/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Dialog.confirm = ({
6363
confirmText = '确定',
6464
closable = false,
6565
onConfirm = noop,
66+
onCancel = noop,
6667
}) => {
6768
const vm = generate({
6869
title,
@@ -73,7 +74,11 @@ Dialog.confirm = ({
7374
btns: [
7475
{
7576
text: cancelText,
76-
handler: /* istanbul ignore next */ () => vm.close(),
77+
handler: /* istanbul ignore next */ () => {
78+
if (onCancel() !== false) {
79+
vm.close()
80+
}
81+
},
7782
},
7883
{
7984
text: confirmText,

0 commit comments

Comments
 (0)