Buefy: [Help] Call $toast.open() on main.js file

Created on 18 Oct 2017  路  3Comments  路  Source: buefy/buefy

Hi, everyone,

I am trying to call a $toast message from my main.js, the bootstrap script for Vue, a bit of code after Vue.use(Buefy), inside axios interceptor.

I tried this.$toast.open, Vue.$toast.open and Buefy.$toast.open but none worked, the $toast is undefined on them.

Someone have an idea how to do this?

Thanks

question

Most helpful comment

I don't think you'll be able to use it on main.js because it's not a vue instance yet, but you can do this:

import { Toast } from 'buefy'

Toast.open([...])

All 3 comments

I do something like this.

            axios.delete(URI)
                .then(() => {
                    this.$snackbar.open(this.texts.delete_success);
                })

I don't think you'll be able to use it on main.js because it's not a vue instance yet, but you can do this:

import { Toast } from 'buefy'

Toast.open([...])

@rafaelpimpa, it worked! Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RomainMazB picture RomainMazB  路  3Comments

teryngull picture teryngull  路  3Comments

OGhawsi picture OGhawsi  路  3Comments

BenjaminVockenberg picture BenjaminVockenberg  路  3Comments

kaeltis picture kaeltis  路  3Comments