perf(scrollbar): update bar when window resize (#1456)

This commit is contained in:
kooriookami 2021-02-24 19:42:15 +08:00 committed by GitHub
parent 2f981ab85a
commit 73b6d5492e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,12 +100,18 @@ export default defineComponent({
onMounted(() => {
if (props.native) return
nextTick(update)
!props.noresize && addResizeListener(resize.value, update)
if (!props.noresize) {
addResizeListener(resize.value, update)
addEventListener('resize', update)
}
})
onBeforeUnmount(() => {
if (props.native) return
!props.noresize && removeResizeListener(resize.value, update)
if (!props.noresize) {
removeResizeListener(resize.value, update)
removeEventListener('resize', update)
}
})
return {