Javascript 无法使用BrowserWindow.loadURL()在Electron中包装网页
我正在尝试获取用于加载论坛的应用程序,例如: 我可以得到基本的网页,但当我改变行Javascript 无法使用BrowserWindow.loadURL()在Electron中包装网页,javascript,electron,Javascript,Electron,我正在尝试获取用于加载论坛的应用程序,例如: 我可以得到基本的网页,但当我改变行win.loadURL时(https://github.com)至win.loadURL(https://ask.fedoraproject.org/)electron应用程序的标题正确更改,但整个窗口为白色。当我检查开发工具时,它看起来不仅仅是一个显示网页的问题,因为大部分页面都丢失了 下面的代码中是否有我可以用来解决问题的内容 const electron = require('electron'); const
win.loadURL时(https://github.com)
至win.loadURL(https://ask.fedoraproject.org/)
electron应用程序的标题正确更改,但整个窗口为白色。当我检查开发工具时,它看起来不仅仅是一个显示网页的问题,因为大部分页面都丢失了
下面的代码中是否有我可以用来解决问题的内容
const electron = require('electron');
const { app, BrowserWindow } = require('electron');
const url = require('url')
const path = require('path')
let win;
function createWindow() {
const win = new BrowserWindow({
show: false,
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.once('ready-to-show', () => {
win.show()
})
win.loadURL('https://ask.fedoraproject.org/')
}
app.whenReady().then(createWindow)
// macOS quirks
app.on('closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
谢谢大家! 哎呀,检查控制台给了我答案 检查控制台,发现缺少模块
矩
时出错
在项目目录中运行了npm安装--save dev moment,现在一切正常了:)