【发布时间】:2021-02-20 13:36:33
【问题描述】:
我正在尝试使用 Electron.js 对话框方法 showMessageBoxSync 创建一个消息框。我希望按钮是“取消”和“覆盖并继续”。我希望它以与按钮为“取消”和“确定”时的框相同的方式显示。
当按钮为“取消”和“确定”时,按钮并排显示:
但是,当我尝试将按钮设置为“取消”和“覆盖并继续”时,消息框的显示方式不同:
是否可以将“覆盖并继续”按钮设置为与“确定”按钮相同的显示方式?
我的消息框代码是:
const userSelection = dialog.showMessageBoxSync(mainWindow, {
type: 'warning',
title: 'User data already exists in this location',
message: 'User data for the App already exists in this location. Do you want to overwrite it?',
buttons: ['Cancel', 'Overwrite and Continue'],
defaultId: 0,
cancelId: 0
})
【问题讨论】:
标签: javascript node.js windows electron messagebox