封装公共窗口

---------- 封装公共窗口 -----------------
 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')
posted @ 2022-01-30 17:06  13522679763-任国强  阅读(24)  评论(0)    收藏  举报