zoukankan      html  css  js  c++  java
  • 如何隐藏electron窗体的菜单栏

    electron中默认带有顶部菜单栏,有时候我们的应用不需要。

    再main.js文件中设置

    const electron = require('electron')
    
    const path = require('path')
    const url = require('url')
    
    let mainWindow
    const Menu = electron.Menu
    function createWindow () {
     
    // 隐藏菜单栏
      Menu.setApplicationMenu(null)
      // Create the browser window.设置窗口宽高,最小宽高,图标等
      mainWindow = new BrowserWindow({  800, height: 600, minWidth: 1280, minHeight: 800, resizable: false, allowRunningInsecureContent: true, experimentalCanvasFeatures: true, icon: './favicon.ico'})
      mainWindow.loadURL("http://www.nlfit.cn/saas/index.html#/login")
     
      mainWindow.on('closed', function () {
        mainWindow = null
      })
    }
    const electron = require('electron')
    // Keep a global reference of the window object, if you don't, the window will
    // be closed automatically when the JavaScript object is garbage collected.

    // const app = electron.app
    // const BrowserWindow = electron.BrowserWindow
    const path = require('path')
    const url = require('url')

    let mainWindow
    const Menu = electron.Menu
    function createWindow () {
    Menu.setApplicationMenu(null)
    // Create the browser window.
    mainWindow = new BrowserWindow({ 800, height: 600, minWidth: 1280, minHeight: 800, resizable: false, allowRunningInsecureContent: true, experimentalCanvasFeatures: true, icon: './favicon.ico'})
    // and load the index.html of the app.
    mainWindow.loadURL("http://www.nlfit.cn/saas/index.html#/login")
    // Open the DevTools.
    // mainWindow.webContents.openDevTools()

    // Emitted when the window is closed.
    mainWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null
    })
    }
  • 相关阅读:
    java 23种设计模式及具体例子 收藏有时间慢慢看
    java中的内存一般分成几部分?
    深入浅出Java垃圾回收机制
    HashMap、HashTable、LinkedHashMap和TreeMap用法和区别
    java 序列化与反序列化
    JAVA中int、String的类型相互转换
    java IO和NIO 的区别
    数据库设计
    服务器硬件优化
    系统配置优化
  • 原文地址:https://www.cnblogs.com/wanf/p/9208611.html
Copyright © 2011-2022 走看看