@@ -21,16 +21,16 @@ const breadcrumbArr = computed(() => {
21
21
22
22
// 切换tabs
23
23
function tabClick(val : number | string = 0 , delay = true ) {
24
- let name : any
24
+ let fullPath : any
25
25
if (typeof val === ' number' ) {
26
- name = tabs .value [val ].name
26
+ fullPath = tabs .value [val ].fullPath
27
27
} else {
28
- name = val
28
+ fullPath = val
29
29
}
30
30
setTimeout (
31
31
() => {
32
32
router .push ({
33
- name ,
33
+ fullPath ,
34
34
})
35
35
},
36
36
delay ? 200 : 0 ,
@@ -42,19 +42,19 @@ const visible = ref(false)
42
42
const top = ref (0 )
43
43
const left = ref (0 )
44
44
let clickName = ' '
45
- function rightClick(e : { x: number ; y: number }, name : string ) {
46
- clickName = name
45
+ function rightClick(e : { x: number ; y: number }, fullPath : string ) {
46
+ clickName = fullPath
47
47
left .value = e .x + 5
48
48
top .value = e .y + 5
49
49
visible .value = true
50
50
}
51
51
function closeMenu() {
52
52
visible .value = false
53
53
}
54
- function tabRemove(name : string = clickName ) {
55
- const index = tabs .value .findIndex ((i : App .Tab ) => i .name === name )
56
- removeTab (name )
57
- if (route .name === name ) {
54
+ function tabRemove(fullPath : string = clickName ) {
55
+ const index = tabs .value .findIndex ((i : App .Tab ) => i .fullPath === fullPath )
56
+ removeTab (fullPath )
57
+ if (route .fullPath === fullPath ) {
58
58
const nextTabIndex = index > tabs .value .length - 1 ? tabs .value .length - 1 : index
59
59
tabClick (nextTabIndex )
60
60
}
@@ -65,7 +65,7 @@ function tabRemoveOther() {
65
65
}
66
66
function tabRemoveRight() {
67
67
removeRightTab (clickName )
68
- if (tabs .value .every ((i : App .Tab ) => i .name !== route .name )) {
68
+ if (tabs .value .every ((i : App .Tab ) => i .fullPath !== route .fullPath )) {
69
69
tabClick (clickName )
70
70
}
71
71
}
@@ -127,23 +127,23 @@ function dragenter(e: { preventDefault: () => void }, index: number) {
127
127
<transition-group name =" tabs" >
128
128
<div
129
129
v-for =" (item, index) in tabs"
130
- :key =" item.name "
130
+ :key =" item.fullPath "
131
131
class =" tab-item"
132
- :class =" { 'tab-active': item.name === route.name }"
132
+ :class =" { 'tab-active': item.fullPath === route.fullPath }"
133
133
draggable =" true"
134
- @click =" tabClick(item.name , false)"
135
- @contextmenu.prevent =" rightClick($event, item.name )"
134
+ @click =" tabClick(item.fullPath , false)"
135
+ @contextmenu.prevent =" rightClick($event, item.fullPath )"
136
136
@dragenter =" dragenter($event, index)"
137
137
@dragover =" dragover($event)"
138
138
@dragstart =" dragstart(index)"
139
139
>
140
- <div v-show =" item.name === route.name " class =" circle" />
140
+ <div v-show =" item.fullPath === route.fullPath " class =" circle" />
141
141
<div class =" content" >
142
142
{{ item.title }}
143
143
</div >
144
144
<div
145
145
class =" carbon:close close-icon hover:carbon:close-filled"
146
- @click.stop =" tabRemove(item.name )"
146
+ @click.stop =" tabRemove(item.fullPath )"
147
147
/>
148
148
</div >
149
149
</transition-group >
0 commit comments