// const finalConfig = Object.assign(baseConfig,config) const finalConfig = {...baseConfig,...config} super(finalConfig) this.loadFile(fileLocation) // 优化弹出窗口 this.once('ready-to-show',()=>{ this.show() }) } } const mainWindow = new AppWindow({},'./renderer/index.html')
封装公共窗口
---------- 封装公共窗口 -----------------
class AppWindow extends BrowserWindow {
constructor(config,fileLocation){
const baseConfig = {
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
}
// const finalConfig = Object.assign(baseConfig,config) const finalConfig = {...baseConfig,...config} super(finalConfig) this.loadFile(fileLocation) // 优化弹出窗口 this.once('ready-to-show',()=>{ this.show() }) } } const mainWindow = new AppWindow({},'./renderer/index.html')
// const finalConfig = Object.assign(baseConfig,config) const finalConfig = {...baseConfig,...config} super(finalConfig) this.loadFile(fileLocation) // 优化弹出窗口 this.once('ready-to-show',()=>{ this.show() }) } } const mainWindow = new AppWindow({},'./renderer/index.html')