我的 index.html 中有一個(gè)按鈕,我想在單擊時(shí)打開(kāi)第二個(gè)窗口。我已將以下內(nèi)容添加到我的 index.js 中:const button = document.getElementById('newtask');button.addEventListener('click', () => { newtaskwindow();});function newtaskwindow() { const BrowserWindow = remote.BrowserWindow; const win = new BrowserWindow({ height: 400, width: 600 }); win.loadURL('createtasks.html');}在 npm start 上,我收到以下錯(cuò)誤:
1 回答

呼如林
TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超3個(gè)贊
我必須創(chuàng)建第二個(gè) js 文件并輸入:
const button = document.getElementById('newtask');
button.addEventListener('click', () => {
newtaskwindow();
});
function newtaskwindow() {
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
const win = new BrowserWindow({
height: 600,
width: 800
});
win.loadURL('createtasks.html');
}
- 1 回答
- 0 關(guān)注
- 121 瀏覽
添加回答
舉報(bào)
0/150
提交
取消