html:

<div class="orgTree" @click.stop="stopMp" ref="treeWrap">
    .....
</div>

js:

mounted () {
    let _this = this;
    document.addEventListener('mouseup',(e) =>{
        let tree = this.$refs.treeWrap
        if (tree) {
          if (!tree.contains(e.target)) {
            this.isShowTree =false
          }
        }
      })      
}

转自:https://www.cnblogs.com/mmzuo-798/p/12703264.html

Logo

前往低代码交流专区

更多推荐