|
|
@@ -31,7 +31,6 @@ watch(() => route, (val) => {
|
|
|
tabbarStore.add(val)
|
|
|
nextTick(() => {
|
|
|
const index = tabbarStore.list.findIndex(item => item.tabId === activedTabId.value)
|
|
|
- console.log(tabbarStore.list, activedTabId,3333)
|
|
|
if (index !== -1) {
|
|
|
const tabEl = tabRef.value?.find(item => Number.parseInt(item.dataset.index!) === index)
|
|
|
const containerEl = tabsRef.value?.ref?.$el
|
|
|
@@ -183,18 +182,28 @@ onMounted(() => {
|
|
|
onUnmounted(() => {
|
|
|
hotkeys.unbind('alt+left,alt+right,alt+w,alt+1,alt+2,alt+3,alt+4,alt+5,alt+6,alt+7,alt+8,alt+9,alt+0')
|
|
|
})
|
|
|
+const stripQuery = (path: string) => path.split('?')[0];
|
|
|
+const checkActived = (fullPath: string, activedTabId: string) => {
|
|
|
+ console.log(stripQuery(fullPath), stripQuery(activedTabId))
|
|
|
+
|
|
|
+ return stripQuery(fullPath) === stripQuery(activedTabId);
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="tabbar">
|
|
|
+ <!-- {{ tabbarStore.list }} -->
|
|
|
<component :is="useSlots('tabbar-start')" />
|
|
|
<div class="tabbar-container">
|
|
|
<FaScrollArea ref="tabsRef" :scrollbar="false" mask horizontal gradient-color="var(--g-tabbar-bg)" class="tabs">
|
|
|
<TransitionGroup ref="tabContainerRef" name="tabbar" tag="div" class="tab-container">
|
|
|
<div
|
|
|
- v-for="(element, index) in tabbarStore.list" :key="element.tabId"
|
|
|
+ v-for="(element, index) in tabbarStore.list" :key="element.fullPath"
|
|
|
+ :data-a="element.fullPath"
|
|
|
+ :data-b="activedTabId"
|
|
|
ref="tabRef" :data-index="index" class="tab" :class="{
|
|
|
- actived: element.tabId === activedTabId,
|
|
|
+ actived: checkActived(element.fullPath, activedTabId),
|
|
|
}" @click="router.push(element.fullPath)"
|
|
|
>
|
|
|
<FaContextMenu :items="contextMenuItems(element)">
|