本文操作环境: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" }) } })
推荐学习:php培训
以上就是vue.js如何实现弹窗功能的详细内容。
