quickcommand.showConfirmBox

This commit is contained in:
fofolee 2022-04-02 01:06:47 +08:00
parent 1a1d7f160b
commit 3b87dce4fa
2 changed files with 21 additions and 5 deletions

View File

@ -9,7 +9,6 @@ import {
} from 'quasar'
import inputBox from "../components/InputBox"
console.log(Notify);
let showInputBox = (options = [], title = "") => {
return new Promise((reslove, reject) => {
@ -28,12 +27,25 @@ let showInputBox = (options = [], title = "") => {
reslove(Array.from(results))
}).onCancel(() => {
console.log('取消')
}).onDismiss(() => {
console.log('对话框被关闭')
})
})
};
let showConfirmBox = (message = "", title = "提示") => {
return new Promise((reslove, reject) => {
Dialog.create({
title: title,
message: message,
cancel: true,
persistent: true
}).onOk(() => {
reslove(true)
}).onCancel(() => {
reslove(false)
})
})
}
let showMessageBox = (message, icon = 'success', time = 3000) => {
if (icon === 'success') icon = 'positive'
if (icon === 'error') icon = 'negative'
@ -44,7 +56,10 @@ let showMessageBox = (message, icon = 'success', time = 3000) => {
position: 'top',
})
}
export default {
showInputBox,
showMessageBox
showMessageBox,
showConfirmBox
};

View File

@ -133,9 +133,10 @@ interface quickcommandApi {
* confirmed && console.log('点击了确定')
* })
* ```
* @param message
* @param title
*/
showConfirmBox(title?: string): Promise<boolean>;
showConfirmBox(message?: string, title?: string): Promise<boolean>;
/**
*