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
How to use with vue 3? #186
Comments
I'd be interested also. Edit: dist files are not up-to-date and need to be rebuild. The issue is that the build command is broken. However then I get other errors about vue-loader
|
If you need Vue 3 support, you might want to check out Vue Toastification v2, which offers similar features and native Vue 3 support. |
@shakee93 it's been a while can we get some sort of eta or a roadmap? Would really like to use this in my upcoming project, I've put off toasts for now but I'll have to implement them eventually. |
Toasted works by extending the const prevPrototype = Vue.prototype
Vue.prototype = {}
Vue.use(Toasted, {/*...*/})
Object.assign(Vue.config.globalProperties, Vue.prototype)
Vue.prototype = prevPrototype |
any news about vue 3 version? |
This works 🎉 |
One can use this one it has same API |
This works for me: // my injectToasted.js file
import Toasted from 'vue-toasted'
const TOASTED_OPTIONS = { className: 'toast', duration: 1000 }
export default function injectToasted (component, globalProperties) {
const mockVue = {
use (plugin, args) {
plugin.install(this, args)
},
component
}
mockVue.prototype = {}
mockVue.use(Toasted, TOASTED_OPTIONS)
Object.assign(globalProperties, mockVue.prototype)
}
// my main.js file
...
const app = createApp(App)
injectToasted(app.component, app.config.globalProperties)
... |
For nuxt 3:
import VueToasted from "vue-toasted";
export default defineNuxtPlugin((nuxtApp) => {
const prevPrototype = nuxtApp.vueApp.prototype;
nuxtApp.vueApp.prototype = {};
nuxtApp.vueApp.use(VueToasted, {
/* options */
});
Object.assign(
nuxtApp.vueApp.config.globalProperties,
nuxtApp.vueApp.prototype
);
nuxtApp.vueApp.prototype = prevPrototype;
}); |
help!
The text was updated successfully, but these errors were encountered: