不同的 electron .html 文件合而为一

Different electron .html files in one

我需要以某种方式将很多 html 页面导入电子中(我使用 w2ui 布局)。

我试过:

<iframe src="../map/index.html"></iframe>

但它不起作用:

<script>require('./index.js');</script>

(Uncaught ReferenceError: require is not defined at index.html:15)

据我了解,您想将多个文件中的 HTML 包含到一页中。

您可以使用 jQuery $('#elementToLoadHtmlInTo').load('url/pathToFile')

您也可以尝试使用 nodejs 中的 fs 模块从您的文件中加载内容,然后将其添加到您的文件中。