feat: configurable persistent tabs

This commit is contained in:
vince
2024-07-10 00:50:41 +08:00
parent 41d0495630
commit db76325d68
23 changed files with 177 additions and 176 deletions

View File

@@ -25,15 +25,15 @@ defineOptions({
withDefaults(defineProps<Props>(), {
icon: '',
});
const emit = defineEmits<{ close: []; unPushPin: [] }>();
const emit = defineEmits<{ close: []; unpinTab: [] }>();
const { b, e, is } = useNamespace('chrome-tab');
function handleClose() {
emit('close');
}
function handleUnPushPin() {
emit('unPushPin');
function handleUnpinTab() {
emit('unpinTab');
}
</script>
@@ -66,7 +66,7 @@ function handleUnPushPin() {
<div
v-show="affixTab && !onlyOne"
:class="[e('extra'), is('pin', true)]"
@click.stop="handleUnPushPin"
@click.stop="handleUnpinTab"
>
<MdiPin :class="e('extra-icon')" />
</div>

View File

@@ -22,7 +22,7 @@ const props = withDefaults(defineProps<Props>(), {
tabs: () => [],
});
const emit = defineEmits<{ close: [string]; unPushPin: [TabItem] }>();
const emit = defineEmits<{ close: [string]; unpinTab: [TabItem] }>();
const gap = 7;
@@ -77,8 +77,8 @@ onMounted(() => {
function handleClose(key: string) {
emit('close', key);
}
function handleUnPushPin(tab: TabItem) {
emit('unPushPin', tab);
function handleUnpinTab(tab: TabItem) {
emit('unpinTab', tab);
}
</script>
@@ -103,7 +103,7 @@ function handleUnPushPin(tab: TabItem) {
:title="tab.title"
@click="active = tab.key"
@close="() => handleClose(tab.key)"
@un-push-pin="() => handleUnPushPin(tab)"
@unpin-tab="() => handleUnpinTab(tab)"
/>
</TransitionGroup>
</div>