javascript - 永远不会调用 showMessageBox 承诺
问题描述
消息框正确显示,但是当我选择其中一个按钮时,不会触发关闭。这是我的代码:
dialog.showMessageBox(options, (response, checkboxChecked) => {
/* More code like log statements, opening error boxes, etc*/
}
选项定义为choices = ["Yes", "No"], message = "Confirm"
。
花括号内的代码永远不会运行。
解决方案
尝试:
const options = {
type: 'question',
buttons: ['Cancel', 'Yes, please', 'No, thanks'],
defaultId: 2,
title: 'Question',
message: 'Do you want to do this?',
detail: 'It does not really matter',
checkboxLabel: 'Remember my answer',
checkboxChecked: true,
};
dialog.showMessageBox(null, options, (response, checkboxChecked) => {
console.log(response);
console.log(checkboxChecked);
});
推荐阅读
- kubernetes - 无法将本地 docker 映像与 docker desktop kubernetes 一起使用
- tensorflow - 将具有 1 个输出的层乘以具有多个输出的层
- azure - ftp 到 azure 存储 blob(触发处理)
- python - Pyspark 数据框不删除所有重复项
- python - exec_command 和在 Paramiko 上使用 invoke_shell() 发送有什么区别?
- angular - Angular Router - 拦截子路由更改
- scala - 如何访问scala中子类实例中的超类字段?
- typescript - 有人可以向我解释这种类型 (() => void)[] = []
- ios - 想要将图像直接从图像选择器传输到具有 uimageview 的另一个视图
- c# - .net mvc 项目和 arduino 之间使用 esp8266 进行通信