我想在电子 js 中为关于应用程序(windows)创建自定义子 window

I want to create custom child window for about application (for windows) in electron js

我想创建一个子浏览器window 来显示有关我的应用程序的一些要点。累积对于电子 js 文档,它支持 Mac OS“关于”角色,但不支持 windows 的任何内容。因此,我正在为 windows 创建自定义 window。我创建了一个 window,但我不知道如何在其中呈现 html。任何知道的人请提供一些解决方案。我正在添加我到目前为止所做的代码。谢谢

    const childURL = `file://${__dirname}/index_child.html
    let child = new BrowserWindow({
    parent: mainWindow,
    modal: true,
    show: false,
    width: 700,
    height: 700,
    minimizable: false,
    maximizable: false,
    fullscreenable: false,
  })
  child.loadURL(childURL)
  child.once('ready-to-show', () => {
    child.show()
  })

您不需要自己使用文件协议。 你可以使用 loadFile 方法。

或者如果您仍想使用文件协议。你少了一个斜杠。

const childURL = `file:///${path.resolve(__dirname, "index_child.html")}`

let child = new BrowserWindow({
    parent: mainWindow,
    modal: true,
    show: false,
    width: 700,
    height: 700,
    minimizable: false,
    maximizable: false,
    fullscreenable: false,
});

child.loadFile("index_child.html");

child.once('ready-to-show', () => {
    child.show()
})