关闭el-date-picker时间选择

关闭 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()
      }
    },

}
posted @   崛起崛起  阅读(814)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示