Fixed incorrect tab switching on closing

This commit is contained in:
2023-11-30 08:35:31 +01:00
parent d72f91d810
commit a6fa615bc4
2 changed files with 5 additions and 5 deletions

View File

@@ -25,8 +25,8 @@ function remove() {
</script>
<template>
<div @click="activate" :class=" isActive ? 'tab-active' : 'tab'" class="flex flex-row gap-3 cursor-pointer">
<button class="hover:brightness-110"><slot /></button>
<div :class=" isActive ? 'tab-active' : 'tab'" class="flex flex-row gap-3">
<button @click="activate" class="hover:brightness-110"><slot /></button>
<button @click="remove" class="hover:brightness-110 hover:bg-blue-100 hover:dark:bg-slate-400 hover:dark:text-black px-2 rounded-full">x</button>
</div>
</template>

View File

@@ -21,7 +21,7 @@ const activeTabId = ref(0);
const tabs = ref(new Array<TabData>);
tabs.value.push({
id: newTabId.value++,
name: "XML1",
name: "xml1.xml",
data: "",
})
@@ -86,7 +86,7 @@ function addTab() {
tabs.value.push({
id: newTabId.value++,
name: "XML" + newTabId.value,
name: "xml" + newTabId.value + ".xml",
data: ""
});
}
@@ -101,7 +101,7 @@ function removeTab(id : number) {
let indexToRemove = findIndexWithID(id);
switchToExistingTab(indexToRemove)
switchToExistingTab(indexToRemove);
tabs.value.splice(indexToRemove, 1);