2020
10-08
10-08
vue 点击其他区域关闭自定义div操作
方法一:在外层div添加事件@click="closeSel"htmlmethodcloseSel(event){varcurrentCli=document.getElementById("sellineName");if(currentCli){if(!currentCli.contains(event.target)){//点击到了id为sellineName以外的区域,隐藏下拉框this.listLineUl=false;}}}方法二、element.addEventListener(event,function,useCapture)mounted中document.addEventListener('click',e=>{if(...
继续阅读 >