愚蠢的問題,但我一直在努力嘗試更改 Electron 窗口的名稱一段時間,所以希望這里有人可以幫助我。我正在嘗試將其從“Electron”更改為其他任何內容。我可以將所有其他標題/名稱更改為我想要的,但無論我嘗試什么,它總是說“Electron”... :(<!-- index.html --><!DOCTYPE html><html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <!-- Window name isn't this --> </head> <body> <h1>hi</h1> </body></html>// main.jsconst { app, BrowserWindow } = require('electron')function createWindow() { const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true }, title: 'Foo' // Window name isn't this }) app.setName('Bar') // Window name isn't this win.setTitle('ReeeeeBar') // Window name isn't this win.loadFile('index.html')}app.whenReady().then(createWindow)// package.json{ "name": "foobar-electron-app", // Window name isn't this "main": "main.js", "dependencies": { "electron": "^9.1.2" }}非常具體地說,我正在嘗試更改此設置:
如何在 ElectronJS 中設置窗口名稱/標題?
絕地無雙
2022-12-18 16:20:59