created () {
    if (!this.isDisabled) {
      const listener = (e, el) => {
        if (
          e.target === el ||
          el.contains(e.target) ||
          (this.whitelist.includes(e.target))
        ) return
        if (this.do) this.do()
      }

      canUseDOM && document.addEventListener('click', e => listener(e, this.$el))

      this.$once('hook:beforeDestroy', () => {
        document.removeEventListener('click', e => listener(e, this.$el))
      })
    }
  }
CClickOutside component

The component that listens to DOM click events and
executes a function based on component props and whitelisted nodes.