关闭 el-date-picker 时间选择功能
问题:下拉滚动条,el-date-picker 还是展开状态
期望:下拉滚顶条让 el-date-picker 关闭。
解决方案:监控滚动高度,当滚动条高度大于 0,调用 this.$refs.时间插件命名.hidePicker()
mounted(){
window.addEventListener('scroll', this.handleScroll, true)
}
methods:{
handleScroll() {
let dom = document.querySelector('.overflowBox')
this.$nextTick(() => {
this.scrollTop = dom.scrollTop
})
}
}
watch:{
scrollTop(newVal, oldVal) {
if (newVal > 0) {
this.$refs.datePicker.hidePicker()
}
},
}
标签:picker,el,refs,关闭,date,scrollTop
From: https://www.cnblogs.com/hxy--Tina/p/16870043.html