Pārlūkot izejas kodu

增加快捷键打开开发者工具栏

Michael Wang 6 gadi atpakaļ
vecāks
revīzija
23ea526b43
2 mainītis faili ar 17 papildinājumiem un 2 dzēšanām
  1. 2 2
      electronStart.js
  2. 15 0
      public/index.html

+ 2 - 2
electronStart.js

@@ -7,8 +7,8 @@ let win;
 function createWindow() {
   // Create the browser window.
   win = new BrowserWindow({
-    width: 800,
-    height: 600,
+    width: 1000,
+    height: 720,
     webPreferences: {
       preload: require("path").join(__dirname, "faceSetMysql.js")
     }

+ 15 - 0
public/index.html

@@ -7,6 +7,21 @@
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
   <title>photo-upload</title>
+  <script>
+    var firstStepKey = false
+    document.addEventListener("keydown", function (e) {
+      console.log(e);
+      if (e.ctrlKey && e.shiftKey && e.code === 'KeyU') {
+        window.firstStepKey = true;
+        setTimeout(() => {
+          window.firstStepKey = false
+        }, 1000);
+      }
+      if (window.firstStepKey && e.ctrlKey && e.shiftKey && e.code === 'KeyP') {
+        nodeRequire('electron').remote.getCurrentWindow().toggleDevTools();
+      }
+    });
+  </script>
   <script type="text/javascript">
     if (typeof (require) != "undefined") {
       window.nodeRequire = require;