From bb04d82473b44a79e9b823ab2054ee79814098a2 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 21 Feb 2022 11:38:31 +0800
Subject: [PATCH] +整体任务实行流程完善

---
 App.vue |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/App.vue b/App.vue
index f5f7fc0..d5f7b90 100644
--- a/App.vue
+++ b/App.vue
@@ -27,8 +27,27 @@
 				}
 			}
 		},
-		watch: {},
-		mounted() {},
+		computed: {
+			socketValue() {
+				return this.$store.state.socketValue;
+			}
+		},
+		watch: {
+			socketValue() {
+				console.log(this.socketValue);
+				let that = this;
+				if (that.socketValue.type === "start") {
+					console.log("任务开启")
+					this.$store.commit("addTask", this.socketValue.rid);
+				} else if (that.socketValue.type === "stop") {
+					console.log("任务结束")
+					this.$store.commit("stopTask", this.socketValue.rid);
+				}
+			}
+		},
+		mounted() {
+			this.$store.dispatch("connectws");
+		},
 		onLaunch: function() { //初始化完成时触发(全局只触发一次)
 			console.log('第一次进入')
 			// Window.say = Window.console;

--
Gitblit v1.9.3