[英]type error dialog.showmessageBoxSync is not a function
I just started using electron and fail to use showmessageBoxSync
: it returns the error:我刚开始使用 electron 并且无法使用
showmessageBoxSync
:它返回错误:
type error dialog.showmessageBoxSync is not a function
类型错误 dialog.showmessageBoxSync 不是 function
isn't showmessageBoxSync
a member of dialog
which is a property of returned object returned by require('electron');
showmessageBoxSync
不是dialog
的成员,它是由require('electron');
? ? what am I missing?
我错过了什么? the dialog variable is declared as:
对话框变量声明为:
const { app, BrowserWindow, dialog } = require('electron');
this is the full code:这是完整的代码:
const { app, BrowserWindow, dialog } = require('electron');
const url = require('url');
function newApp() {
dialog.showmessageBoxSync({
message: 'hello world'
});
win = new BrowserWindow();
win.loadURL(
url.format({
pathname: "index.html",
slashes: true
})
);
win.on('closed', () => {
win = null;
});
}
app.on("ready", newApp);
The method is dialog.showMessageBoxSync
, with a capital M.该方法是
dialog.showMessageBoxSync
,大写 M。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.