vue-command-palette icon indicating copy to clipboard operation
vue-command-palette copied to clipboard

[Feature Request] Support close dialog when click mask

Open Deuscx opened this issue 2 years ago • 2 comments
trafficstars

Is it able to support close-on-click-model like element-plus dialog https://element-plus.org/en-US/component/dialog.html#attributes image

Deuscx avatar Mar 09 '23 11:03 Deuscx

Hi @xiaoluoboding,

I think I found a way to solve this problem using onClickOutside function.

Can I contribute the solution to the project?

thara003 avatar Apr 19 '23 19:04 thara003

Another solution would be adding a listener on a parent element like the mask. You can set this on the component where the palette is mounted.

This is what i did in my repository

document.body.addEventListener('click', (event) => {
  if (event.target.matches('[command-dialog-mask]')) {
    if (this.ui.show) this.hide()
  }
})

gsabater avatar Apr 18 '24 12:04 gsabater