Merge pull request #189 from DevDengChao/feat/close-tab-on-mouse-mid-click

feat: close tab on mouse mid-button click
pull/831/MERGE
芋道源码 2025-11-22 19:07:53 +08:00 committed by GitHub
commit 261aa31dd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -255,6 +255,15 @@ const canShowIcon = (item: RouteLocationNormalizedLoaded) => {
return false
}
const closeTabOnMouseMidClick = (e: MouseEvent, item) => {
// button === 1
if (e.button === 1) {
e.preventDefault()
e.stopPropagation()
closeSelectedTag(item)
}
}
onBeforeMount(() => {
initTags()
addTags()
@ -293,6 +302,7 @@ watch(
v-for="item in visitedViews"
:key="item.fullPath"
:ref="itemRefs.set"
@auxclick="closeTabOnMouseMidClick($event, item)"
:class="[
`${prefixCls}__item`,
tagsViewImmerse ? `${prefixCls}__item--immerse` : '',