From 93d4267567a02eeb28f86c8612c0d645ccd853f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8F=8F?= Date: Fri, 4 Sep 2020 10:03:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E7=BB=84=E4=BB=B6mounted?= =?UTF-8?q?=E9=92=A9=E5=AD=90=E6=89=A7=E8=A1=8C=E6=97=B6=20=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8F=AF=E8=83=BD=E5=B7=B2=E7=BB=8Fonload=20=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=20=E6=BB=9A=E5=8A=A8=E6=A0=A1=E9=AA=8C=E4=B8=8D?= =?UTF-8?q?=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/header-aside/components/menu-header/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layout/header-aside/components/menu-header/index.js b/src/layout/header-aside/components/menu-header/index.js index bd34c80a..1460602d 100644 --- a/src/layout/header-aside/components/menu-header/index.js +++ b/src/layout/header-aside/components/menu-header/index.js @@ -128,7 +128,7 @@ export default { mounted () { // 初始化判断 // 默认判断父元素和子元素的大小,以确定初始情况是否显示滚动 - window.addEventListener('load', this.checkScroll) + this.checkScroll() // 全局窗口变化监听,判断父元素和子元素的大小,从而控制isScroll的开关 this.throttledCheckScroll = throttle(this.checkScroll, 300) window.addEventListener('resize', this.throttledCheckScroll) @@ -136,6 +136,5 @@ export default { beforeDestroy () { // 取消监听 window.removeEventListener('resize', this.throttledCheckScroll) - window.removeEventListener('load', this.checkScroll) } }