Files
Shuodedaoli-Deskpet/main/main.js

30 lines
683 B
JavaScript
Raw Normal View History

const { app, BrowserWindow, ipcMain } = require('electron')
2025-08-05 23:30:00 +08:00
const path = require('path')
let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({
width: 300,
height: 300,
transparent: true,
frame: false,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
2025-08-05 23:30:00 +08:00
contextIsolation: true
}
})
// 开发模式加载Vite服务器
if (process.env.NODE_ENV === 'development') {
mainWindow.loadURL('http://localhost:5173')
} else {
mainWindow.loadFile(path.join(__dirname, '../renderer/dist/index.html'))
}
mainWindow.setIgnoreMouseEvents(true, {
forward: true
})
2025-08-05 23:30:00 +08:00
}
app.whenReady().then(createWindow)