修复白屏问题
This commit is contained in:
parent
546f94c10d
commit
da37cb44ae
@ -3,21 +3,17 @@ import path from "path";
|
||||
import startServe, { closeServe } from "src/app";
|
||||
|
||||
function createMainWindow(): void {
|
||||
const isDev = process.env.NODE_ENV === "dev" || !app.isPackaged;
|
||||
const basePath = isDev ? process.cwd() : app.getAppPath();
|
||||
|
||||
const win = new BrowserWindow({
|
||||
width: 900,
|
||||
height: 600,
|
||||
show: true,
|
||||
autoHideMenuBar: true,
|
||||
icon: path.join(
|
||||
basePath,
|
||||
"scripts",
|
||||
process.platform === "win32" ? "logo.ico" : "logo.png"
|
||||
),
|
||||
});
|
||||
const htmlPath = path.join(basePath, "scripts", "web", "index.html");
|
||||
// 开发环境和生产环境使用不同的路径
|
||||
const isDev = process.env.NODE_ENV === "dev" || !app.isPackaged;
|
||||
const htmlPath = isDev
|
||||
? path.join(process.cwd(), "scripts", "web", "index.html")
|
||||
: path.join(app.getAppPath(), "scripts", "web", "index.html");
|
||||
void win.loadFile(htmlPath);
|
||||
}
|
||||
app.whenReady().then(async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user