Selaa lähdekoodia

:bug: Fixing a bug. 切换到nacos 动态路由无效,不刷新 #276 #275

冷冷 6 vuotta sitten
vanhempi
commit
bccdeebff3
3 muutettua tiedostoa jossa 24 lisäystä ja 8 poistoa
  1. 7 0
      src/api/admin/route.js
  2. 8 6
      src/views/admin/route/index.vue
  3. 9 2
      vue.config.js

+ 7 - 0
src/api/admin/route.js

@@ -32,3 +32,10 @@ export function putObj (obj) {
     data: obj
   })
 }
+
+export function refreshObj () {
+  return request({
+    url: '/actuator/refresh',
+    method: 'post',
+  })
+}

+ 8 - 6
src/views/admin/route/index.vue

@@ -31,7 +31,7 @@
 </template>
 <script>
   import vueJsonEditor from 'vue-json-editor'
-  import {fetchList, putObj} from '@/api/admin/route'
+  import {fetchList, putObj,refreshObj} from '@/api/admin/route'
 
   export default {
     data() {
@@ -70,11 +70,13 @@
 
       edit() {
         putObj(this.json).then(() => {
-          this.$notify({
-            title: '成功',
-            message: '更新成功',
-            type: 'success',
-            duration: 2000
+          refreshObj().then(() => {
+            this.$notify({
+              title: '成功',
+              message: '更新成功',
+              type: 'success',
+              duration: 2000
+            })
           })
         })
       }

+ 9 - 2
vue.config.js

@@ -49,11 +49,18 @@ module.exports = {
           '^/code': '/code'
         }
       },
-      '/gen': {
+      '/code': {
+        target: url,
+        ws: true,
+        pathRewrite: {
+          '^/code': '/code'
+        }
+      },
+      '/actuator': {
         target: url,
         ws: true,
         pathRewrite: {
-          '^/gen': '/gen'
+          '^/actuator': '/actuator'
         }
       },
       '/mp': {