electron 应用在mac全屏最大化后复原窗口按钮为灰色,如何解决?

如果大家测试出mac平台下全屏后第二个和第三个红绿灯能高亮,就发代码
image.png
image.png

const createWindow = () => {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 980,
    minWidth: 980,
    minHeight: 650,
    height: 650,
    // frame:false,
    titleBarStyle: "hidden",
    minimizable: true,
    maximizable: true,
    transparent: false,
    // visualEffectState: "active",
    // vibrancy: "fullscreen-ui",
    alwaysOnTop: true,
    // fullscreenable:false,
    // opacity:0.9,
    // fullscreen:true,
    closable: true,
    webPreferences: {
      // devTools:false,
      nodeIntegration: true, //在渲染进程启用Node.js
      contextIsolation: true,
      webSecurity: true,
      backgroundThrottling: false,
      preload: path.join(__dirname, 'preload.js'),
    },
  });

  // and load the index.html of the app.
  if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
    mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
  } else {
    mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
  }
  mainWindow.webContents.openDevTools();
};
阅读 1.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题