vue.js如何实现弹窗功能

来自:互联网
时间:2021-10-10
阅读:

实现思路:

在点击完之后点击其他位置跳转路由,路由跳转后利用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"
       })    
   } 
})

vue.js如何实现弹窗功能

返回顶部
顶部