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

@@ -142,6 +142,13 @@ export function useTabsViewScroll(props: TabsProps) {
scrollIsAtRight.value = right;
}, 100);
function handleWheel({ deltaY }: WheelEvent) {
scrollViewportEl.value?.scrollBy({
behavior: 'smooth',
left: deltaY * 3,
});
}
watch(
() => props.active,
async () => {
@@ -184,6 +191,7 @@ export function useTabsViewScroll(props: TabsProps) {
return {
handleScrollAt,
handleWheel,
initScrollbar,
scrollbarRef,
scrollDirection,