0

I am trying to use this library https://www.npmjs.com/package/click-outside-vue3 for close when i will click outside of the modal?

i made this code:

<div
    v-if="dialogFoundation"
    v-click-outside="close"
  >

 import vClickOutside from 'click-outside-vue3'
 directives: {
  clickOutside: vClickOutside.directive
},
setup() {

  const close = () => {
        console.log(4343)
  }
}

but its not working, i want to close the modal

also i setup the main.js

import vClickOutside from "click-outside-vue3"
...
createApp(App)
  .use(vClickOutside)
signup
  • 135
  • 1
  • 16
  • I did have work around this, check this one [Detect click outside element](https://stackoverflow.com/questions/36170425/detect-click-outside-element) – Naren Apr 11 '22 at 22:04
  • @Naren i want to use that library please – signup Apr 11 '22 at 22:06

1 Answers1

1

have you set the directive as it's found in the documentation ?

directives: {
      clickOutside: vClickOutside.directive
    },

```
Wax
  • 110
  • 6