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:
parent
9d473cc2ba
commit
0e9eaafeea
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user