mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 09:20:51 +08:00
perf(scrollbar): update bar when window resize (#1456)
This commit is contained in:
parent
2f981ab85a
commit
73b6d5492e
@ -100,12 +100,18 @@ export default defineComponent({
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.native) return
|
if (props.native) return
|
||||||
nextTick(update)
|
nextTick(update)
|
||||||
!props.noresize && addResizeListener(resize.value, update)
|
if (!props.noresize) {
|
||||||
|
addResizeListener(resize.value, update)
|
||||||
|
addEventListener('resize', update)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (props.native) return
|
if (props.native) return
|
||||||
!props.noresize && removeResizeListener(resize.value, update)
|
if (!props.noresize) {
|
||||||
|
removeResizeListener(resize.value, update)
|
||||||
|
removeEventListener('resize', update)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user