1. 获取dom的id
<div id="enterStore" > 2. methods写入事件 other(){ document.addEventListener("click", (e) => { let enterStore = document.getElementById("enterStore"); if (enterStore == null) return; if (!enterStore.contains(e.target)) { this.isShowEnterStore = false; } }); } 3. mounted中执行 mounted(){ this.other() } 标签:vue,消失,点击,other,enterStore,mounted,document From: https://www.cnblogs.com/qdyzhuang/p/16934463.html