16、electron clipboard剪切板
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <span id="code">iainKOQNBALNOAD</span> <input type="button" id="btn" value="复制" /> <script> const remote = require('@electron/remote'); const clipboard = remote.clipboard; let btn = document.getElementById("btn"); let code =document.getElementById("code"); btn.onclick = (e)=>{ clipboard.writeText(code.innerText); alert('复制成功'); } </script> </body> </html>