eolant / vuetify-toast-snackbar

Basic Vue toast service that uses Vuetify Snackbar component.
MIT License
127 stars 36 forks source link

update text in real time #20

Closed pedrazadixon closed 4 years ago

pedrazadixon commented 4 years ago

Any way to update a part of message string in real time? I want notification (toast) that update a download progress from axios. ¿Any idea?

eolant commented 4 years ago

As of now, it's not possible. But I played around a bit and there is a way to do it by exposing currently displayed toast component using a method:

this.$toast.info(null, { timeout: 20000 })
setInterval(() => {
  const cmp = this.$toast.getCmp()
  if (cmp) {
    cmp.message = new Date()
  }
}, 1000)

Will this work in your use case?

P.S.: don't mind infinite interval :)

pedrazadixon commented 4 years ago

I try this but getCmp() is not defined.

eolant commented 4 years ago

@pedrazadixon, yes, because I haven't implemented it yet, just asking if this kind of workflow will work for your case?

pedrazadixon commented 4 years ago

Ahhh ok. Of course! It's just what I need

Thank you in advance for your answers.