vue js弹窗功能实现

在点击完之后点击其他位置跳转路由,路由跳转后利用computed属性监听$route进行class的显示和隐藏,利用的是js Contains方法

document.addEventListener('mouseup',(e)=>{
   var _con = document.getElementById('children-view')
   if(_con && !_con.contains(e.target){
       this.$route.push({
           name:"Index"
       })     
   }  
})

 

 

  

posted @ 2020-12-27 10:56  纯、臻  阅读(333)  评论(0编辑  收藏  举报