1<!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <title>Napi</title> 8 </head> 9 10 <body> 11 <style> 12 body { 13 background-color: #778899; 14 padding: 100px; 15 } 16 17 a { 18 text-decoration: none; 19 } 20 21 .input { 22 color: blue; 23 } 24 </style> 25 <script type="text/javascript"> 26 var mode = 0; 27 let vscode = acquireVsCodeApi(); 28 window.onload = function () { 29 document.getElementById("selectMode").addEventListener("change", function (e) { 30 if (e.target.value == 1) { 31 mode = 1; 32 } else { 33 mode = 0; 34 } 35 }); 36 } 37 38 function sendMsg() { 39 var fileNames = document.getElementById("interfaceFile").value; 40 var genDir = document.getElementById("genFile").value; 41 var result = { 42 mode: mode, 43 fileNames: fileNames, 44 genDir: genDir, 45 } 46 vscode.postMessage(result); 47 } 48 49 function cancel() { 50 vscode.postMessage("cancel"); 51 } 52 53 window.addEventListener('message', event => { 54 const message = event.data; 55 document.getElementById("interfaceFile").value = message; 56 }) 57 </script> 58 <div id="selectMode"> 59 选择方式: 60 <input type="radio" name="mode" value="0" id="files" checked="checked">.d.ts文件(多个文件之间用,号分割)</input> 61 <input type="radio" name="mode" value="1" id="dir">文件夹</input> 62 </div> 63 </br> 64 <div id="interface"> 65 选择接口文件: <input type="text" id="interfaceFile"> 66 </div> 67 68 <div style="margin-top: 10px;"> 69 生成框架路径: <input accept="text" id="genFile"> 70 </div> 71 72 <div style="margin-top: 10px;"> 73 编译脚本路径: <input type="text" id="buildFile"> 74 </div> 75 <div style="margin-top: 10px;"> 76 <a href="https://gitee.com/openharmony/napi_generator" target="_blank"> 77 <button style="width: 90px;">Help</button> 78 </a> 79 <button type="button" style="width: 90px;" onclick="cancel()">Cancel</button> 80 <button type="button" style="width: 90px;" onclick="sendMsg()">Ok</button> 81 </div> 82 </body> 83 84 </html>