Vue, why do you use beforeMount? here?

the original problem is to click on the parent component anywhere to make the child component disappear. There is a big guy"s code that reads and asks him that he didn"t answer, so there are two places I don"t know. I would like to ask you
why this code is written into beforeMount? Didn"t you mount beforeMount at the time? the click event can"t be used, is it? And what is the _ close here?

<template>
 <div @click="none">
      <div id="drop-down">
        <Dropdown v-if="dd"></Dropdown>
      </div>
 </div>
</template>
export default {
  name: "Blog",
  data () {
    return {
      dd: true
    }
  },
  methods: {
    none () {
      this.dd = false
    }
  },

Boss"s component code

beforeMount() {
  this._close = e => {
    // 
    if (this.$el.contains(e.target)) {
      return;
    }
    this.$emit("hide");
  };  
  document.body.addEventListener("click", this._close);
},
beforeDestroy() {
  document.body.removeEventListener("click", this._close);  
}
Jun.19,2021

when beforeMount is not mounted, the click event cannot be used, is it?

binds the click event

of body
and what is the _ close here?

this._close is a es6 arrow function defined to use the external this
to determine whether it is inside the component if it is returned directly inside the component and not handled if it is not triggered inside the component hide event

var that = this;
this._close = function (e) {
    // 
    if (that.$el.contains(e.target)) {
      return;
    }
    that.$emit('hide');
};  
Menu