fix: horizontal scrolling invalid when reload component (#642)

This commit is contained in:
star knight
2024-04-23 13:09:26 +08:00
committed by GitHub
parent ea7c359b1b
commit fffcf3a912

View File

@@ -7,11 +7,14 @@ const scrollListWrap = ref<HTMLElement>() as Ref<HTMLElement>
// const showRightMask = ref<boolean>(false)
const showScrollMask = ref<boolean>(true)
watch(() => settings.value.enableHorizontalScrolling, (newValue) => {
if (newValue)
scrollListWrap.value.addEventListener('wheel', handleMouseScroll)
watch([() => settings.value.enableHorizontalScrolling, scrollListWrap], ([enableHorizontalScrolling, scrollListWrap]) => {
if (!scrollListWrap)
return
if (enableHorizontalScrolling)
scrollListWrap.addEventListener('wheel', handleMouseScroll)
else
scrollListWrap.value.removeEventListener('wheel', handleMouseScroll)
scrollListWrap.removeEventListener('wheel', handleMouseScroll)
})
onMounted(() => {