Ming 4 лет назад
Родитель
Сommit
449724434f
2 измененных файлов с 9 добавлено и 1 удалено
  1. 1 0
      src/App.vue
  2. 8 1
      src/store/index.js

+ 1 - 0
src/App.vue

@@ -35,6 +35,7 @@ export default {
 
         that.global.ws.onmessage =  (res)=> {
           this.$store.commit('wsInfoMiT',res)
+          this.$store.commit('pusTimer',30)
         };
 
         that.global.ws.onclose = function () {

+ 8 - 1
src/store/index.js

@@ -6,7 +6,8 @@ Vue.use(Vuex)
 export default new Vuex.Store({
     state: {
         wsInfo: null,
-        StationID: ''
+        StationID: '',
+        wsTimer: 30
     },
     mutations: {
         wsInfoMiT(state, val) {
@@ -15,6 +16,12 @@ export default new Vuex.Store({
         changeStationID(state, val) {
             state.StationID = val
         },
+        pusTimer(state, val) {
+            state.wsTimer = val
+        },
+        editTimer(state) {
+            state.wsTimer--
+        }
     },