You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
const { app , BrowserWindow } = require ( 'electron/main' )
const path = require ( 'node:path' )
function createWindow ( ) {
const win = new BrowserWindow ( {
width : 1100 ,
height : 800 ,
resizable : true , //是否支持调整窗口大小
webPreferences : {
} ,
icon : path . join ( _ _dirname , './public/img/32PX.ico' ) ,
autoHideMenuBar : true , //自动隐藏菜单栏, 除非按了Alt键。 默认值为 false.
} )
if ( process . env . VITE _DEV _SERVER _URL ) {
win . webContents . openDevTools ( ) //在开发者模式下打开控制台
win . loadURL ( process . env . VITE _DEV _SERVER _URL )
} else {
win . loadFile ( './test.html' )
}
}
app . whenReady ( ) . then ( ( ) => {
createWindow ( )
app . on ( 'activate' , ( ) => {
if ( BrowserWindow . getAllWindows ( ) . length === 0 ) {
createWindow ( )
}
} )
} )
app . on ( 'window-all-closed' , ( ) => {
if ( process . platform !== 'darwin' ) {
app . quit ( )
}
} )