aslanon / vue-confirm-dialog

Simple Confirm Dialog verification plugin with Vue.js.
https://aslanon.github.io/vue-confirm-dialog/
MIT License
190 stars 42 forks source link

Doesnt' allow me to click on the popup. #4

Closed rachitpant closed 4 years ago

rachitpant commented 4 years ago

The confirm action ( with value false ) is being triggered without clicking anywhere. popup issue

rachitpant commented 4 years ago

If the code in the debugger is too small:

  confirmDelete() {
      this.$vueConfirm.confirm(
        {
          auth: false,
          message: `Are you sure you want to delete?`,
          button: {
            no: 'No',
            yes: 'Yes'
          }
        },
        function(confirm) {
          if (confirm == true) {
            this.deleteSelectedUsers()
          }
        }
      )
    },

Also I have initialized it correctly , otherwise it wouldn't show. I am using firefox - could this be the issue.

aslanon commented 4 years ago

How do you trigger confirmDelete function? Can you use "stop" modifier?

<tag @click.stop="confirmDelete()"> foo </tag>

You also need to define a variable for scope. So your code should be like below.

   confirmDelete() {
     let self = this
     this.$vueConfirm.confirm(
       {
         auth: false,
         message: `Are you sure you want to delete?`,
         button: {
           no: 'No',
           yes: 'Yes'
         }
       },
       function(confirm) {
         if (confirm == true) {
           self.deleteSelectedUsers()
         }
       }
     )
   },
rachitpant commented 4 years ago

Thanks. I will try this tomorrow. The problem that I think the stop modifier would create is that the action dropdown would not close on click.

The actual event is emitted on click from the child DataTable component ( a component that is wrapping the datatable , search, pagination and action dropdown that you see above. ) . The emitted event is captured in the parent component that calls the confirmDelete method.

KevinLevesque commented 4 years ago

I think I have the same issue.

I have a button which calls a method on click. This method calls this.$vueConfirm.confirm(...) As soon as the dialog opens, it closes immediately.

I found that the documentClick method is launched on every click on the page and seems to be the problem. Maybe we should check if the dialog is open before emiting the close event?

https://github.com/aslanon/vue-confirm-dialog/blob/239eaf9eebe3ed472456c7d44c9be8638f9c795b/src/vue-confirm-dialog.vue#L99-L105

matteogll commented 4 years ago

I have the same issue. The confirmation dialog apper for just few seconds, and then disappear without clicking

aslanon commented 4 years ago

I'm working on the new version. I will solve this bug in a short time.

aslanon commented 4 years ago

This bug is solved the vesion 1.0.1. This version have major changes. Please read to README. README: https://github.com/aslanon/vue-confirm-dialog/blob/master/README.md

RELEASE: https://github.com/aslanon/vue-confirm-dialog/releases/tag/v1.0.1