Polymer 进口电子(聚合物)
我正在尝试用聚合物创建一个电子应用程序。我尝试使用导入自定义元素Polymer 进口电子(聚合物),polymer,electron,Polymer,Electron,我正在尝试用聚合物创建一个电子应用程序。我尝试使用导入自定义元素 <link rel="import" href="src/lux-app.html"> 它没有使用正确的路径。我研究发现,导入仅在服务器(如本地主机)上工作。有没有办法在electron或类似的东西中运行localhost 多谢各位 编辑: 下面是文件结构 lux-app |── bower_components |── images |── lib └── artnet.js
<link rel="import" href="src/lux-app.html">
它没有使用正确的路径。我研究发现,导入仅在服务器(如本地主机)上工作。有没有办法在electron或类似的东西中运行localhost
多谢各位
编辑:
下面是文件结构
lux-app
|── bower_components
|── images
|── lib
└── artnet.js
|── lux-app.html
|── .gitignore
|── bower.json
|── ...
node_modules
└── node stuff
main.js
index.html
polymer.json
package.json
README.json
renderer.js
导入在没有localhost的情况下工作,如中所示。在index.html文件中,有如下导入:
<link rel="import" href="sections/about.html">
<link rel="import" href="sections/windows/windows.html">
<link rel="import" href="sections/windows/crash-hang.html">
<link rel="import" href="sections/menus/menus.html">
因此,我认为您的问题在于main.js主渲染器中的path变量无法正常工作,或者如果您尚未声明该变量,则需要使用const path=require'path,并使用Electron Api演示中main.js文件中的路径
我不是electron方面的专家,但我想我可以让您了解electron api repo中的文件内部的解决方案,它起作用了,但我必须删除并打开窗口。Polymer={rootPath:'/'};。谢谢!
<link rel="import" href="sections/about.html">
<link rel="import" href="sections/windows/windows.html">
<link rel="import" href="sections/windows/crash-hang.html">
<link rel="import" href="sections/menus/menus.html">