mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-30 21:13:02 +08:00
quickcommand.showConfirmBox
This commit is contained in:
parent
1a1d7f160b
commit
3b87dce4fa
@ -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
|
||||
};
|
||||
|
@ -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>;
|
||||
|
||||
/**
|
||||
* 同步等待,会阻塞进程
|
||||
|
Loading…
x
Reference in New Issue
Block a user