Merge pull request #7 from liulinboyi/fix/dialog

fix: $dialog对话框可以异步
This commit is contained in:
Ronnie Zhang 2022-04-08 18:34:23 +08:00 committed by GitHub
commit ea9851ccd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,15 +8,15 @@ const NDialog = useDialog()
class Dialog {
success(title, option) {
this.showDialog('success', { title, ...option })
return this.showDialog('success', { title, ...option })
}
warning(title, option) {
this.showDialog('warning', { title, ...option })
return this.showDialog('warning', { title, ...option })
}
error(title, option) {
this.showDialog('error', { title, ...option })
return this.showDialog('error', { title, ...option })
}
showDialog(type = 'success', option) {
@ -24,7 +24,7 @@ class Dialog {
// ! title
option.showIcon = false
}
NDialog[type]({
return NDialog[type]({
positiveText: 'OK',
closable: false,
...option,
@ -32,7 +32,7 @@ class Dialog {
}
confirm(option = {}) {
this.showDialog(option.type || 'error', {
return this.showDialog(option.type || 'error', {
positiveText: '确定',
negativeText: '取消',
onPositiveClick: option.confirm,