@@ -21,16 +21,16 @@ const breadcrumbArr = computed(() => {
2121
2222// 切换tabs
2323function tabClick(val : number | string = 0 , delay = true ) {
24- let name : any
24+ let fullPath : any
2525 if (typeof val === ' number' ) {
26- name = tabs .value [val ].name
26+ fullPath = tabs .value [val ].fullPath
2727 } else {
28- name = val
28+ fullPath = val
2929 }
3030 setTimeout (
3131 () => {
3232 router .push ({
33- name ,
33+ fullPath ,
3434 })
3535 },
3636 delay ? 200 : 0 ,
@@ -42,19 +42,19 @@ const visible = ref(false)
4242const top = ref (0 )
4343const left = ref (0 )
4444let 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
4747 left .value = e .x + 5
4848 top .value = e .y + 5
4949 visible .value = true
5050}
5151function closeMenu() {
5252 visible .value = false
5353}
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 ) {
5858 const nextTabIndex = index > tabs .value .length - 1 ? tabs .value .length - 1 : index
5959 tabClick (nextTabIndex )
6060 }
@@ -65,7 +65,7 @@ function tabRemoveOther() {
6565}
6666function tabRemoveRight() {
6767 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 )) {
6969 tabClick (clickName )
7070 }
7171}
@@ -127,23 +127,23 @@ function dragenter(e: { preventDefault: () => void }, index: number) {
127127 <transition-group name =" tabs" >
128128 <div
129129 v-for =" (item, index) in tabs"
130- :key =" item.name "
130+ :key =" item.fullPath "
131131 class =" tab-item"
132- :class =" { 'tab-active': item.name === route.name }"
132+ :class =" { 'tab-active': item.fullPath === route.fullPath }"
133133 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 )"
136136 @dragenter =" dragenter($event, index)"
137137 @dragover =" dragover($event)"
138138 @dragstart =" dragstart(index)"
139139 >
140- <div v-show =" item.name === route.name " class =" circle" />
140+ <div v-show =" item.fullPath === route.fullPath " class =" circle" />
141141 <div class =" content" >
142142 {{ item.title }}
143143 </div >
144144 <div
145145 class =" carbon:close close-icon hover:carbon:close-filled"
146- @click.stop =" tabRemove(item.name )"
146+ @click.stop =" tabRemove(item.fullPath )"
147147 />
148148 </div >
149149 </transition-group >
0 commit comments