vue点击元素以外事件 用户4705138570544 2021-02-24 101 阅读1分钟 mounted(){ document.addEventListener('click',e=>{ if(!this.$el.contains(e.target)){ this.show=false //这句话的意思是点击其他区域关闭(也可以根据自己需求写触发事件) } }) }