首页 > 解决方案 > 使用 Electron BrowserWindow() 的电子滚动问题;

问题描述

我无法让我的电子应用程序允许滚动。请问有人可以帮我吗?下面是我的代码。对不起,我对电子还很陌生,并试图理解它。问题显示为浏览器窗口中的内容超出了窗口的末尾,我无法使用触控板或箭头键向下滚动。

  function createWindow () {

  server.run();
  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 1024,
    height: 768,
    scrollBounce: false,
    webPreferences: {
      nodeIntegration: true,
      contextIsolation: false,
      zoomFactor: 0.8,
      enableRemoteModule: false
    },
    frame: true,
    minWidth: 1024,
    minHeight: 768
  });

  // and load the index.html of the app.
  mainWindow.loadURL('http://'+server.host+':'+server.port+'/')

/*
mainWindow.loadURL(url.format({
  pathname: path.join(__dirname, 'index.php'),
  protocol: 'file:',
  slashes: true
}))
*/
 const {shell} = require('electron')
 shell.showItemInFolder('fullPath')

  // 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.
    // PHP SERVER QUIT
    server.close();
    app.quit();
    mainWindow = null;
  })
}

标签: node.jselectron

解决方案


推荐阅读