私は最近、エレクトロンで足を濡らし始めました。私はそれの背後にある原則が本当に好きですが、いくつかのことをするのはちょっと混乱しています。電子処理入力
たとえば、ユーザー入力をどのように処理しますか?私はmain.jsとローカルHTMLファイル(入力フィールドを持ついくつかのユーザ設定を含む)を指し示すBrowserWindowを持っています。
HTMLフォームが送信されたときに(同じファイルか別のファイルに)このデータにアクセスするにはどうすればよいですか?
main.js電子と
const {app, BrowserWindow} = require('electron')
let win
function createWindow() {
win = new BrowserWindow({width: 800, height: 600})
win.loadURL('file://' + __dirname + '/index.html')
// Emitted when the window is closed.
win.on('closed',() => {
win = null
})
// Open the DevTools.
// win.webContents.openDevTools()
}
app.on('window-all-closed',() => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate',() => {
if (win === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
//Start the main window
app.on('ready', createWindow)
index.htmlを
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="" method="post">
<input type="text" name="test-1">
</form>
</body>
</html>