shakee93 / vue-toasted

🖖 Responsive Touch Compatible Toast plugin for VueJS 2+
https://shakee93.github.io/vue-toasted/
MIT License
2.21k stars 194 forks source link

How to remove specific global toast? #185

Open phuc2401 opened 3 years ago

phuc2401 commented 3 years ago

Hello everyone, I checked and see that we only support clear() to clear all toast. Do we have some option to clear specific toast? The case is I registered 2 global toast, one of them will show when we have no internet connection. So when the connection is back, I want to clear that toast, but can't find a suitable option.

shakee93 commented 3 years ago

let offlineToast = this.$toasted.global.my_app_error({
    message : 'You are offline!'
});

offlineToast.goAway();

this doesn't work for you ?

phuc2401 commented 3 years ago

Hi @shakee93, thank you for the response, the case is I registered global Toast like this example, and we can use this.$toasted.global.my_app_error(); to show that toast. But how can I close this global toast? image

shakee93 commented 3 years ago
let offlineToast = this.$toasted.global.my_app_error({
    message : 'You are offline!'
});

offlineToast.goAway();

this doesn't work for you ?

you have to update it like this example. and call goAway to remove the global toast