vue实现点击页面其他地方,隐藏div元素
mounted() {document.addEventListener("click", (e) => {let that = thisif (!this.$el.contains(e.target)) {that.videoShow = false; //点击其他区域关闭} else {that.videoShow = true;}});},
·
mounted() {
document.addEventListener("click", (e) => {
let that = this
if (!this.$el.contains(e.target)) {
that.videoShow = false; //点击其他区域关闭
} else {
that.videoShow = true;
}
});
},
更多推荐
已为社区贡献2条内容
所有评论(0)