mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 16:46:19 +08:00
feat: configurable persistent tabs
This commit is contained in:
@@ -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>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user