Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get confirm notifications to dismiss after button click #51

Open
pslyman opened this issue Jul 23, 2018 · 1 comment
Open

Can't get confirm notifications to dismiss after button click #51

pslyman opened this issue Jul 23, 2018 · 1 comment

Comments

@pslyman
Copy link

pslyman commented Jul 23, 2018

I'm using this in VueJS2:

this.$snotify.confirm('Are you sure you want to delete the "' + field + '" column?', 'Confirm', { timeout: 5000, showProgressBar: true, closeOnClick: true, position: 'centerCenter', pauseOnHover: true, buttons: [ {text: 'Yes', action: () => {this.removeColumn(); this.$snotify.remove(this.toast.id);}, bold: false}, {text: 'No', action: () => this.$snotify.remove(this.toast.id)}, ] });

The main issue I'm having is with this.$snotify.remove(this.toast.id);
(toast.id) gives an error that toast is not defined (as recommended in documentation), so I'm trying to target it using (this.toast.id). It doesn't work.

I've tried using this.$snotify.remove() or this.$snotify.clear(), and technically they work, however the click function (this.removeColumn()) doesn't get called.

I believe this is a bug. Is there a work-around, or am I doing something wrong?

Thanks!

@nros
Copy link

nros commented Nov 5, 2018

You need to use a parameter name with your action function. The current toast data can not made available on this, since you use an ES5 arrow-function. It is provided as parameter. Hence write this:

[
    {text: 'Yes', action: (toast) => {this.removeColumn(); this.$snotify.remove(toast.id);}, bold: false}, 
    {text: 'No', action: (toast) => this.$snotify.remove(toast.id)}
]

see example https://artemsky.github.io/vue-snotify/documentation/essentials/examples.html#confirm

This should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants