The sub-components of vue are hidden under the control of v-show. How to capture the displayed events in the sub-components.

the sub-components of vue are hidden under the control of v-show. How to capture the displayed events in the sub-components

Feb.25,2022

the parent component passes the value corresponding to v-show to the child component, and the child component watch listens


is written in this way:

  • parent component controls child components to show and hide
 <div
        class="dialog_account"
        v-show="isShowAccount" // 
      >
        <SettleAccount @hideAccountDialog="hideAccountDialog"></SettleAccount> //  @hideAccountDialog 
      </div>
  • the child component calls the parent component hide method
 <img
        src="../../assets/btn_Cancel.png"
        alt=""
        @click.stop="$emit('hideAccountDialog')" //
      >
Menu