【发布时间】:2020-11-14 01:28:27
【问题描述】:
我是电子和其他前端技术的新手。我正在尝试使用电子实现桌面应用程序。在此应用程序中,单击按钮应打开一个新窗口。主窗口正常打开,但点击按钮 没有任何反应。我找不到错误。我希望有人能提供帮助。在此先感谢:)
<!DOCTYPE html>
<html>
<head>
<meta charset = "UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" href="../assets/css/index.css">
</head>
<body>
<button id="addAlias" class="buttons">Add Alias</button>
<button id="generateKey" class="buttons">Generate Keys</button>
<button id="balance" class="buttons">Check Balance</button>
<button id="transaction" class="buttons">Send Money</button>
<script>
const button = document.getElementById('addAlias');
button.addEventListener('click', () => {
createBrowserWindow();
});
function createBrowserWindow() {
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
const win = new BrowserWindow({
height: 600,
width: 800
});
win.loadURL('https://stackoverflow.com/questions/53390798/opening-new-window-electron');
win.once('ready-to-show', () => {
win.show()
})
}
</script>
</body>
</html>
【问题讨论】:
标签: javascript html jquery node.js electron