euvl / vue-notification

:icecream: Vue.js 2 library for showing notifications
http://vue-notification.yev.io/
MIT License
2.39k stars 213 forks source link

closeOnClick: false doesn't work when using the API #245

Closed emiliemarchand closed 2 years ago

emiliemarchand commented 3 years ago

Describe the bug Setting the option "closeOnClick: false" doesn't work when triggering a notification via the API.

To Reproduce

  1. In a Vue component, trigger a notification like this:
    this.$notify({
    type: 'warn',
    text: "This is a test",
    duration: -1,    
    closeOnClick: false
    });
  2. Click on the notification that pops up
  3. The notification closes

Expected behavior The notification should not close.

Desktop (please complete the following information):

Additional context The only way I could make it work is by setting the option as a prop on the html tag, which is quite inconvenient because I do not want all notifications to behave this way. <notifications :close-on-click="false" position="top center" width="100%"></notifications>

github-actions[bot] commented 2 years ago

Stale issue message

emiliemarchand commented 2 years ago

Why is this closed? It's not fixed.

ricky11 commented 2 years ago

having the same issue, the doc says closeOnClick but you used : close-on-click

i tried both still does not work.

Mat3uszkek commented 7 months ago

If you need to include a button within the notification for executing further actions, but find that the notification closes upon clicking the button despite setting close-on-click: false, applying event.stopPropagation() within the button's event handler function can prevent this behavior.