title: Migrating "detect click outside" custom directive from Vue 2 to Vue 3
body: <p>Based on this question <a href="https://stackoverflow.com/questions/36170425/detect-click-outside-element">Detect click outside element</a> and this answer <a href="https://stackoverflow.com/a/42389266">https://stackoverflow.com/a/42389266</a>, I'm trying to migrate the directive from Vue 2 to Vue 3. It seems that <code>binding.expression</code> and <code>vnode.context</code> not exists more. How can I make it work?</p>
  <pre><code>app.directive('click-outside', {
      beforeMount (el, binding, vnode) {
          el.clickOutsideEvent = function (event) {
              if (!(el === event.target || el.contains(event.target))) {
                  vnode.context[binding.expression](event);
              }
          };
          document.body.addEventListener('click', el.clickOutsideEvent);
      },
      unmounted (el) {
          document.body.removeEventListener('click', el.clickOutsideEvent);
      }
  });
  </code></pre>