mac踩坑之路

1.打开开发者工具,窗口拖动就会有问题
2.窗口关闭之前请置空Tray.setTitle(title) 中的值,否则就会弹出退出异常


// 引入electron并创建一个Browserwindow
const {
    app, BrowserWindow, globalShortcut, Tray, Menu,ipcMain,dialog} = require('electron')
const path = require('path')
const url = require('url')
const child_process = require('child_process')
const pathName = path.join(__dirname, 'demo/javascript/src/ScreenCapture.app')
const niuniupath=path.join(__dirname, './ScreenCapture.app')
// 保持window对象的全局引用,避免JavaScript对象被垃圾回收时,窗口被自动关闭.
let mainWindow
let tray = null;
//var count = 0,timer=null;
//var count1 = 0,timer1=null;
//设置快捷键
app.on('ready', function () {
   
    globalShortcut.register('ctrl+alt+o', function () {
   
        mainWindow.webContents.send('main-process-messages', 'StartCapture')
    });
    // var t1=setInterval(function(){
   
    //   if(!mainWindow.isMinimized()){
   
    //     clearInterval(timer);
    //   }
    // })
});

function createWindow() {
   
    //创建浏览器窗口,宽高自定义
    mainWindow = new BrowserWindow({
    width: 1024, height: 700, minWidth: 712, minHeight: 505, maximizable: true, icon: 'icon.png', backgroundColor: '#ffffff', frame: false,show:false,movable:true,skipTaskbar:true
    })
    mainWindow.once('ready-to-show', () => {
   
        mainWindow.show()
    }) 
    //加载应用-----  electron-quick-start中默认的加载入口
    mainWindow
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值