Skip to content

Commit

Permalink
feat(projects): close tab by mouse wheel button click
Browse files Browse the repository at this point in the history
  • Loading branch information
JianJroh committed Apr 29, 2024
1 parent e3bd397 commit d3849ba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/materials/src/libs/page-tab/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,23 @@ const bindProps = computed(() => {
function handleClose() {
emit('close');
}
function handleMouseup(e: MouseEvent) {
// close tab by mouse wheel button click
if (e.button === 1) {
handleClose();
}
}
</script>

<template>
<component :is="activeTabComponent.component" :class="activeTabComponent.class" :style="cssVars" v-bind="bindProps">
<component
:is="activeTabComponent.component"
:class="activeTabComponent.class"
:style="cssVars"
v-bind="bindProps"
@mouseup="handleMouseup"
>
<template #prefix>
<slot name="prefix"></slot>
</template>
Expand Down

0 comments on commit d3849ba

Please sign in to comment.