BinarCode / vue-notifyjs

Minimalist 1kb Notification component
MIT License
170 stars 28 forks source link

Catch the click event on the entire message #11

Closed coreation closed 6 years ago

coreation commented 6 years ago

Hi there, I have a question, is it possible to make a custom handler for the click event on the message? I see that notification component is emitting a "close" event, but it stops at the notifications component which consumes it. Another possibility could be that I can catch a click event on the entire message inside the custom render function, but I don't see how I could achieve that...

(previous conversation: https://github.com/cristijora/vue-notifyjs/issues/9#issuecomment-347433938)

@cristijora thank you for the reply! So what do I do if I want to catch the click on the entire notification component? So basically catch the @close event on the notification. The example you provided was helpful, but only works on the button or the component that you define.

cristijora commented 6 years ago

@coreation I don't think this is currently possible but it can be implemented. The only restriction would be that you won't be able to do async operations and only after that close the message.

coreation commented 6 years ago

I think that's fine, my use case is the following:

So it's a bit similar to like facebook, where you can click the dropdown alerts on the top right, click a notification and get redirected. Is it ok if I try to make a branch for this? I'm not sure when I'll be able to work on it, we're going to use it in one of our projects, but depending on how much time it'll take, i'll get my hands dirty sooner or later :)

cristijora commented 6 years ago

@coreation No problems. It's not hard to implement

cristijora commented 6 years ago

Released a new version Changes here Demo: https://codesandbox.io/s/w2lyzxz25l