From 4a5b8dd0057f568ef844d503d0f6c27a1be2f0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=A0=E9=BE=99?= Date: Wed, 21 Sep 2022 17:13:39 +0800 Subject: [PATCH] fix: fix --- src/components/common/ScrollX.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/common/ScrollX.vue b/src/components/common/ScrollX.vue index cb447f4..e612597 100644 --- a/src/components/common/ScrollX.vue +++ b/src/components/common/ScrollX.vue @@ -38,16 +38,16 @@ const wrapper = ref(null) const isOverflow = ref(false) const refreshIsOverflow = debounce(() => { - const wrapperWidth = wrapper.value.offsetWidth - const contentWidth = content.value.offsetWidth + const wrapperWidth = wrapper.value?.offsetWidth + const contentWidth = content.value?.offsetWidth isOverflow.value = contentWidth > wrapperWidth resetTranslateX(wrapperWidth, contentWidth) }, 200) function handleMouseWheel(e) { const { wheelDelta } = e - const wrapperWidth = wrapper.value.offsetWidth - const contentWidth = content.value.offsetWidth + const wrapperWidth = wrapper.value?.offsetWidth + const contentWidth = content.value?.offsetWidth /** * @wheelDelta 平行滚动的值 >0: 右移 <0: 左移 * @translateX 内容translateX的值