vue.js实现弹窗功能的方法:【document.addEventListener('mouseup',(e)=>{var _con = document.getElementById('children-view')if(_c...】。
/2021/10/f364c8d0.jpg
本文操作环境:windows10系统、vue.js 2.9、thinkpad t480电脑。
实现思路:
在点击完之后点击其他位置跳转路由,路由跳转后利用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" }) } })
/2021/10/c0b745d0.png" /2021/10/c0b745d0.png" alt="3492ee5b09b26d6db2b9f1c3cb68f82.png
推荐学习:php培训
以上就是vue.js如何实现弹窗功能的详细内容,更多请关注北冥有鱼其它相关文章!
本文转载自【PHP中文网】,希望能给您带来帮助,苟日新、日日新、又日新,生命不息,学习不止。