Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-20 19:09:21 +08:00

feat: "tags-view" support wheel scroll (#62)

This commit is contained in:
_island 2023-03-17 16:16:52 +08:00 committed by GitHub
parent 9d473cc2ba
commit 0e9eaafeea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,14 @@ const scroll = ({ scrollLeft }: { scrollLeft: number }) => {
currentScrollLeft = scrollLeft
}
const wheelScroll = ({ deltaY }: WheelEvent) => {
if (/^-/.test(deltaY.toString())) {
scrollTo("left")
} else {
scrollTo("right")
}
}
/** 点击滚动 */
const scrollTo = (direction: "left" | "right") => {
let scrollLeft = 0
@ -48,7 +56,7 @@ const showScreenfull = computed(() => {
<el-icon class="arrow left" @click="scrollTo('left')">
<ArrowLeft />
</el-icon>
<el-scrollbar ref="scrollbarRef" @scroll="scroll">
<el-scrollbar ref="scrollbarRef" @wheel.prevent="wheelScroll" @scroll="scroll">
<div ref="scrollbarContentRef" class="scrollbar-content">
<slot />
</div>