-
Notifications
You must be signed in to change notification settings - Fork 10
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
Unable to call SnackbarProgrammatic outside of Vue instance #188
Comments
@mateuswetah If it is in a setup script, there is a workaround: Since there is no global Vue instance in Vue 3, you need somehow specify a Vue app instance. If you have a Vue app instance known, you can do something like below: import { ModalProgrammatic } from '@ntohq/buefy-next'
// somehow you know a Vue app instance
const modalProgrammatic = new ModalProgrammatic(app)
modalProgrammatic.open({
// parameters ...
}) The above behavior was newly introduced in buefy-next, though, it is subject to change. |
Ok, I'll see if I can figure a way to pass the app instance there... but a question. If I do manage to do it, wouldn't it be the same thing of doing something like this? app.config.globalProperties.$buefy.snackbar.open(... |
Oh and now that I read the discussion, I do like the |
BUT... giving a try, import { getCurrentInstance } from 'vue';
const self = getCurrentInstance(); At least directly in my |
Since |
Oh ok, didn't payed attention to the |
Overview of the problem
Buefy-next version: 0.1.2
Vuejs version: 3.4.15
OS/Browser: Firefox, Linux Ubuntu
Description
Previously, I could instantiate Snackbar or even Modal by using something like
This was useful in situations like this, where I'm passing the error handler to use Snackbar as an alert every time axios detects an error.
In the new version, I'm getting an error, and it is a weird one... it does not outputs clearly the issue, but debugging a little bit, it seems that
Snackbar.open
yieldsundefined
😢.I'm I doing something wrong? Would it be possible some other way, without access to
$buefy
?The text was updated successfully, but these errors were encountered: