我已经创建了Electron+ React桌面应用程序。当我尝试用"index.html"加载时,会遇到问题,因为它只加载,只加载简单的js,而不是js(react代码).Please引导我完成这个任务。
这是在Main.js里
mainWindow.loadURL(file://${path.join(__dirname,'../build/index.html')});
这是我的index.html加载index.js,它有反应代码
需要(“./src/index.html”)
谢谢
发布于 2019-10-17 07:39:14
尝试使用url.format代替。这是指向文档的链接。
就像这样。
mainWindow.loadURL(isDev
? url.format({
pathname: path.join(__dirname, '../build/index.html'),
protocol: 'file:',
}),
: url.format({
pathname: path.join(__dirname, '../build/index.html'),
protocol: 'file:',
})
);https://stackoverflow.com/questions/58426971
复制相似问题