perf: optimize ScrooX component.

This commit is contained in:
张传龙 2022-07-09 15:03:39 +08:00
parent 76c3f0b64c
commit fd08d25ccf

View File

@ -37,7 +37,10 @@ const wrapper = ref(null)
const isOverflow = ref(false) const isOverflow = ref(false)
const refreshIsOverflow = debounce(() => { const refreshIsOverflow = debounce(() => {
isOverflow.value = content.value.offsetWidth > wrapper.value.offsetWidth const wrapperWidth = wrapper.value.offsetWidth
const contentWidth = content.value.offsetWidth
isOverflow.value = contentWidth > wrapperWidth
resetTranslateX(wrapperWidth, contentWidth)
}, 200) }, 200)
function handleMouseWheel(e) { function handleMouseWheel(e) {