docs: update demo to catch errors, close: #2912

This commit is contained in:
Benjy Cui 2016-09-10 18:14:23 +08:00
parent 9777c7d065
commit 25cb3e2d30

View File

@ -23,9 +23,9 @@ function showConfirm() {
title: 'Are you sure you want to delete this item ?',
content: 'When clicked the OK button, this dialog will be closed after 1 second',
onOk() {
return new Promise((resolve) => {
setTimeout(resolve, 1000);
});
return new Promise((resolve, reject) => {
setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
}).catch(() => console.log('Oops errors!'));
},
onCancel() {},
});