-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (35 loc) · 1.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sqlite3 Test</title>
</head>
<body>
<div
style="display: grid;grid-template-columns: 1fr;grid-template-rows: 30px 30px 30px calc( 100% - 90px );">
<h1>Insert Data:</h1>
<input type="text" value="test" id="text" />
<button id="btn">insert </button>
<div id="log">
<p>log:</p>
</div>
</div>
<script>
const btn = document.getElementById('btn')
const input = document.getElementById('text')
const log = document.getElementById('log')
btn.onclick = async (e) => {
const text = input.value
const p = document.createElement('p')
p.innerText = 'insert data:' + text + `(${(new Date).toLocaleString()})`
log.appendChild(p)
electron?.insertData(text).then(res=>{
p.innerText+=',return:\n\n'+JSON.stringify(res)
}).catch(e=>{
p.innerText+=',err:\n' + e.message
console.log(`insert data:${text} err:`,e)
})
}
</script>
</body>
</html>