xushining 3 лет назад
Родитель
Сommit
832d5c31f4
2 измененных файлов с 18 добавлено и 5 удалено
  1. 16 3
      src/assets/script/WEBSocket.js
  2. 2 2
      src/background.js

+ 16 - 3
src/assets/script/WEBSocket.js

@@ -1,5 +1,18 @@
-export default{
-    data:{
-        hello,
+class messagebridge{
+    constructor(){
+        
+    }
+}
+
+class websocket{
+    webSocket;
+    url;
+    construtor(url){
+        this.url=url;
+        this.webSocket=new WebSocket(url);
+        this.webSocket.onopen=this.webSocketOnOpen;
+    }
+    webSocketOnOpen(){
+        console.log("websocket连接成功!")
     }
 }

+ 2 - 2
src/background.js

@@ -28,8 +28,8 @@ async function createWindow() {
       
       // Use pluginOptions.nodeIntegration, leave this alone
       // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
-      nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
-      contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
+      nodeIntegration: true,
+      contextIsolation: false,
     }
   })