首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行Electron+React应用程序时面临的问题

运行Electron+React应用程序时面临的问题
EN

Stack Overflow用户
提问于 2019-10-17 07:19:32
回答 1查看 48关注 0票数 0

我已经创建了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”)

谢谢

EN

回答 1

Stack Overflow用户

发布于 2019-10-17 07:39:14

尝试使用url.format代替。这是指向文档的链接

就像这样。

代码语言:javascript
复制
    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:',
      })
    );
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58426971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档