Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
FairyEver committed Apr 23, 2019
2 parents d007ae6 + 884a693 commit 1b38a06
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/layout/header-aside/components/menu-header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,15 @@ export default {
mounted () {
// 初始化判断
// 默认判断父元素和子元素的大小,以确定初始情况是否显示滚动
this.checkScroll()
window.addEventListener('load', this.checkScroll)
// 全局窗口变化监听,判断父元素和子元素的大小,从而控制isScroll的开关
this.throttledCheckScroll = throttle(this.checkScroll, 300)
window.addEventListener('resize', this.throttledCheckScroll)
},
beforeDestroy () {
// 取消监听
window.removeEventListener('resize', this.throttledCheckScroll)
window.removeEventListener('load', this.checkScroll)
}
}
</script>

0 comments on commit 1b38a06

Please sign in to comment.