We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to use vue-snotify in a Vue.js TypeScript project.
At the moment, I'm importing and using it:
import Snotify from 'vue-snotify'; Vue.use(Snotify);
I'm trying to show a toast in the global Vue.config.errorHandler. But the property $snotify isn't available on the global Vue instance like:
Vue.$snotify.success(...
Are there any other ways of doing this?
The text was updated successfully, but these errors were encountered:
I've been able to do this in my router by calling Vue.prototype.$snotify.success(...).
Vue.prototype.$snotify.success(...)
Sorry, something went wrong.
Hey all! 👋
You need to extends VueJs types. You can do that by creating an index.d.ts at the root of your directory and add the following content.
index.d.ts
import Vue from 'vue' import { SnotifyService } from 'vue-snotify/SnotifyService' declare module 'vue/types/vue' { interface Vue { $snotify: SnotifyService } }
This code will extends the Vue interface and add $snotifyproperty with the correct type - so you can have IntelliSense.
$snotify
The best would be to have this library handle this for us. I don't know what @artemsky thinks, I can create a PR to fix this.
@RomainLanz 's answser was exactly what I needed - this wasn't obvious at all nor easy to find, and wasn't mentioned anywhere in the docs!!
No branches or pull requests
I'm trying to use vue-snotify in a Vue.js TypeScript project.
At the moment, I'm importing and using it:
I'm trying to show a toast in the global Vue.config.errorHandler. But the property $snotify isn't available on the global Vue instance like:
Vue.$snotify.success(...
Are there any other ways of doing this?
The text was updated successfully, but these errors were encountered: