methods:{
hidder (e) {
console.log(e) //打印一下e可以看到具体内容和其他解决方法
//判断点击的位置在弹出框之外
if (e.srcElement.className!=='searchListcss') {
this.searchListShow = false; //等于false隐藏弹出框
}
}
},
}
mounted() {
//添加点击事件 true 在捕获阶段执行
document.addEventListener('click', this.hidder,true);
},
//ps合不合标准我不知道,但是能实现效果(^v^),
vue点击其他区域隐藏当前弹出框
最新推荐文章于 2023-09-25 23:27:03 发布