feat: tabbar support mouse wheel vertical (#5129)

* feat: tabbar support mouse wheel

* docs: add tabbar wheelable tips

* chore: resolve vitest test
This commit is contained in:
Netfan
2024-12-13 14:45:06 +08:00
committed by GitHub
parent be208fe915
commit 7fbf7b189a
12 changed files with 54 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ const props = withDefaults(defineProps<Props>(), {
contentClass: 'vben-tabs-content',
draggable: true,
styleType: 'chrome',
wheelable: true,
});
const emit = defineEmits<TabsEmits>();
@@ -27,6 +28,7 @@ const forward = useForwardPropsEmits(props, emit);
const {
handleScrollAt,
handleWheel,
scrollbarRef,
scrollDirection,
scrollIsAtLeft,
@@ -34,6 +36,14 @@ const {
showScrollButton,
} = useTabsViewScroll(props);
function onWheel(e: WheelEvent) {
if (props.wheelable) {
handleWheel(e);
e.stopPropagation();
e.preventDefault();
}
}
useTabsDrag(props, emit);
</script>
@@ -69,6 +79,7 @@ useTabsDrag(props, emit);
shadow-left
shadow-right
@scroll-at="handleScrollAt"
@wheel="onWheel"
>
<TabsChrome
v-if="styleType === 'chrome'"