ndelvalle / v-click-outside

🔲 Vue directive to react on clicks outside an element without stopping the event propagation
MIT License
967 stars 88 forks source link

Not working on vue3 #601

Open dwickern opened 2 years ago

dwickern commented 2 years ago

It seems the release process stripped out all vue3-specific code.

https://www.runpkg.com/?v-click-outside@3.2.0/dist/v-click-outside.umd.js

^^ The hooks are hard-coded as bind/update/unbind

nextmat commented 2 years ago

I'm running into the same issue.

It looks like directive support for Vue 3 was added in https://github.com/ndelvalle/v-click-outside/pull/563, after the latest published release (3.2.0, May 15 2022, https://github.com/ndelvalle/v-click-outside/commit/f525d4b393858d3a66414b1522be307be2e1ebf8).

@ndelvalle - any chance of an updated release?

dwickern commented 2 years ago

I switched to this one instead: https://vueuse.org/core/onClickOutside

eviler007 commented 1 year ago
import vClickOutside from 'v-click-outside';
const { bind, unbind } = vClickOutside.directive;

app.directive('click-outside', {
  mounted(el, bindling) {
    bind(el, { value: bindling.value });
  },
  beforeUnmount(el) {
    unbind(el);
  },
});