李志伟 3 年前
父节点
当前提交
4fe57f870b
共有 2 个文件被更改,包括 12 次插入16 次删除
  1. 2
    2
      src/router/index.js
  2. 10
    14
      src/views/gameManage/edit.vue

+ 2
- 2
src/router/index.js 查看文件

@@ -93,7 +93,7 @@ export const constantRoutes = [
93 93
     ]
94 94
   },
95 95
 
96
-  //微信配置
96
+  // 微信配置
97 97
 
98 98
   {
99 99
     path: '/WeChatConfig',
@@ -152,7 +152,7 @@ const createRouter = () => new Router({
152 152
 const router = createRouter()
153 153
 
154 154
 // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
155
-export function resetRouter () {
155
+export function resetRouter() {
156 156
   const newRouter = createRouter()
157 157
   router.matcher = newRouter.matcher // reset router
158 158
 }

+ 10
- 14
src/views/gameManage/edit.vue 查看文件

@@ -114,20 +114,16 @@ export default {
114 114
     }
115 115
   },
116 116
   watch: {
117
-    '$route.query.id'(val) {
118
-      // immediate: true
119
-      this.gameId = val
120
-      getGameDetail(val).then((res) => {
121
-        this.gameForm = res.data
122
-      })
123
-    }
124
-  },
125
-  mounted() {
126
-    if (this.$route?.query.id) {
127
-      this.gameId = this.$route.query.id
128
-      getGameDetail(this.$route.query.id).then((res) => {
129
-        this.gameForm = res.data
130
-      })
117
+    '$route.query.id': {
118
+      handler(val) {
119
+        if (val) {
120
+          this.gameId = val
121
+          getGameDetail(val).then((res) => {
122
+            this.gameForm = res.data
123
+          })
124
+        }
125
+      },
126
+      immediate: true
131 127
     }
132 128
   },
133 129
   methods: {