【发布时间】:2018-09-09 06:59:35
【问题描述】:
我创建了一个新的电子应用程序。
它由以下文件组成:
index.html
main.js
renderer.js
在 index.html 中,我添加了一个带有 onclick 事件的按钮:
<button onclick="myfunction()">Call Function</button>
该功能只是用于测试目的的警报:
myfunction() {
alert('I am the js function');
}
我的问题是我已经将函数代码添加到了 renderer.js 和 main.js 的底部,当我单击按钮时,我没有看到任何警报。
如何从 index.html 中获取要调用的 js 函数?
【问题讨论】:
-
如果你正在使用
myfunction,你应该在document.ready之外添加 -
你的意思是 main.js 中的 app.on('ready', createWindow) ?
标签: javascript electron