Fixed incorrect tab switching on closing
This commit is contained in:
@@ -25,8 +25,8 @@ function remove() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div @click="activate" :class=" isActive ? 'tab-active' : 'tab'" class="flex flex-row gap-3 cursor-pointer">
|
<div :class=" isActive ? 'tab-active' : 'tab'" class="flex flex-row gap-3">
|
||||||
<button class="hover:brightness-110"><slot /></button>
|
<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>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -21,7 +21,7 @@ const activeTabId = ref(0);
|
|||||||
const tabs = ref(new Array<TabData>);
|
const tabs = ref(new Array<TabData>);
|
||||||
tabs.value.push({
|
tabs.value.push({
|
||||||
id: newTabId.value++,
|
id: newTabId.value++,
|
||||||
name: "XML1",
|
name: "xml1.xml",
|
||||||
data: "",
|
data: "",
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ function addTab() {
|
|||||||
|
|
||||||
tabs.value.push({
|
tabs.value.push({
|
||||||
id: newTabId.value++,
|
id: newTabId.value++,
|
||||||
name: "XML" + newTabId.value,
|
name: "xml" + newTabId.value + ".xml",
|
||||||
data: ""
|
data: ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ function removeTab(id : number) {
|
|||||||
|
|
||||||
let indexToRemove = findIndexWithID(id);
|
let indexToRemove = findIndexWithID(id);
|
||||||
|
|
||||||
switchToExistingTab(indexToRemove)
|
switchToExistingTab(indexToRemove);
|
||||||
|
|
||||||
tabs.value.splice(indexToRemove, 1);
|
tabs.value.splice(indexToRemove, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user