From 73b6d5492edd31ec7c262947980b1d2c8778a68b Mon Sep 17 00:00:00 2001 From: kooriookami <38392315+kooriookami@users.noreply.github.com> Date: Wed, 24 Feb 2021 19:42:15 +0800 Subject: [PATCH] perf(scrollbar): update bar when window resize (#1456) --- packages/scrollbar/src/index.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/scrollbar/src/index.vue b/packages/scrollbar/src/index.vue index 405e87e794..3595595e5c 100644 --- a/packages/scrollbar/src/index.vue +++ b/packages/scrollbar/src/index.vue @@ -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 {