• layui的layer.close(index)无法关闭弹出层一种可能


    做的是层间弹出,type是1,是个弹出选择框

    然后用this.index=open({...})方式记录了index,然后在点击确定的时候关闭整个弹出层。

    然后很奇怪的在另一个页面能关闭,在这个岗位页面关闭不了。

    自己尝试找到弹出的最顶层,然后隐藏,但发现layer关闭后就会销毁自己添加的标签,自己找比较麻烦,遂放弃。

    然后在确定按钮事件里打印this.index,能打印出来,一直是4。

    反复调试中,找到弹出层最外层,发现其id是“xxxxxx1”。。。。

    有些疑惑,在控制台直接layer.close(1),弹出层关闭!

    。。。。T M D 不知道为什么,我页面的这个button点击一次触发4次!然后我在layer.open里加了id,防止其重复弹出,倒是不重复弹出了,但每次执行layer.open都会返回一个新的index,覆盖原来的。

    。。。。还非常整齐的,每次点击触发4次click事件!

    对不上自然关闭不了。。。

    最后给按钮加上了防频繁触发解决问题。。。

    let current_entity
    let curr_time
    function set_select(){
        if(m=="view")return
        $("#person_select").click(function(){
            let new_date=new Date().getTime()
            if(!curr_time || new_date-curr_time>2000){
                curr_time=new_date
            }else{
                if(new_date-curr_time<1000)return
            }
            current_entity=$("#person")
            user_select_div(current_entity.val().split(","),true)
        })
    }
  • 相关阅读:
    Django REST framework+Vue 打造生鲜电商项目(笔记三)
    「数据结构与算法之链表(Python)」(四)
    微服务的注册中心
    git学习(十一) idea git pull 解决冲突
    git学习(十) idea git reset 操作
    git学习(九) idea git stash操作
    git学习(八) git stash操作
    git 学习笔记
    git学习(五) git diff操作
    git:Your branch and 'origin/master' have diverged
  • 原文地址:https://www.cnblogs.com/ztw1122/p/15767969.html
Copyright © 2020-2023  润新知