做的是層間彈出,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) }) }