Selaa lähdekoodia

[SCREEN] ADD ws config

sgw 1 vuosi sitten
vanhempi
commit
fc1afcbed3
3 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 1 0
      public/index.html
  2. 6 0
      public/static/config.js
  3. 4 1
      src/store/index.js

+ 1 - 0
public/index.html

@@ -6,6 +6,7 @@
         <meta name="viewport" content="width=device-width,initial-scale=1.0">
         <link rel="icon" href="<%= BASE_URL %>favicon.ico">
         <title>训练态势大屏</title>
+        <script type="text/javascript" src="static/config.js"></script>
     </head>
     <body>
         <noscript>

+ 6 - 0
public/static/config.js

@@ -0,0 +1,6 @@
+window.config = {
+  webSocket: {
+    url: "localhost",
+    port: "8084"
+  }
+}

+ 4 - 1
src/store/index.js

@@ -4,7 +4,10 @@ import Vuex from "vuex";
 Vue.use(Vuex);
 
 export default new Vuex.Store({
-  state: {},
+  state: {
+    webSocketIp: window.config.webSocket.url,
+    webSocketPort: window.config.webSocket.port
+  },
   mutations: {},
   actions: {},
   modules: {},