File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
view/systemTools/autoCode Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,32 @@ export const useRouterStore = defineStore('router', () => {
52
52
const asyncRouterFlag = ref ( 0 )
53
53
const setKeepAliveRouters = ( history ) => {
54
54
const keepArrTemp = [ ]
55
+
56
+ // 1. 首先添加原有的keepAlive配置
57
+ keepArrTemp . push ( ...keepAliveRoutersArr )
58
+
55
59
history . forEach ( ( item ) => {
60
+ // 2. 为所有history中的路由强制启用keep-alive
61
+ // 通过routeMap获取路由信息,然后通过pathInfo获取组件名
62
+ const routeInfo = routeMap [ item . name ]
63
+ if ( routeInfo && routeInfo . meta && routeInfo . meta . path ) {
64
+ const componentName = pathInfo [ routeInfo . meta . path ]
65
+ if ( componentName ) {
66
+ keepArrTemp . push ( componentName )
67
+ }
68
+ }
69
+
70
+ // 3. 如果子路由在tabs中打开,父路由也需要keepAlive
56
71
if ( nameMap [ item . name ] ) {
57
72
keepArrTemp . push ( nameMap [ item . name ] )
58
73
}
59
74
} )
75
+
60
76
keepAliveRouters . value = Array . from ( new Set ( keepArrTemp ) )
77
+ console . log ( keepAliveRouters . value )
61
78
}
62
79
80
+
63
81
const route = useRoute ( )
64
82
65
83
emitter . on ( 'setKeepAlive' , setKeepAliveRouters )
Original file line number Diff line number Diff line change @@ -83,6 +83,10 @@ import { ref, reactive } from 'vue'
83
83
import { ElMessage } from ' element-plus'
84
84
import { mcp } from ' @/api/autoCode'
85
85
86
+ defineOptions ({
87
+ name: ' MCP'
88
+ })
89
+
86
90
const formRef = ref (null )
87
91
const form = reactive ({
88
92
name: ' ' ,
Original file line number Diff line number Diff line change @@ -139,6 +139,11 @@ import { ElMessage } from 'element-plus'
139
139
import { VideoPlay , DocumentCopy } from ' @element-plus/icons-vue' // Added DocumentCopy
140
140
import { mcpList , mcpTest } from ' @/api/autoCode'
141
141
142
+ defineOptions ({
143
+ name: ' MCPTest'
144
+ })
145
+
146
+
142
147
const mcpTools = ref ([])
143
148
const testDialogVisible = ref (false )
144
149
const currentTestingTool = ref (null )
You can’t perform that action at this time.
0 commit comments