Comments (4)
Well, I just found out how to use it. You have to provide
and inject
!
This is my main.ts
:
app.use(Toaster).provide('toast', app.config.globalProperties.$toast);
This is my App.ts
:
mounted() {
this.$toast.show('Toast from mounted()!');
},
setup(props, context): any {
const toast: any = inject('toast');
toast.show('Toast from setup()!');
}
from vue-toaster.
It must be added in documentation here https://vuejsexamples.com/vue-js-toast-notification-plugin-for-vue-3/
from vue-toaster.
Thank you!
from vue-toaster.
Thanks @andgeno !!
from vue-toaster.
Related Issues (20)
- Add github star and fork buttons on example
- Doesn't work in Typescript HOT 1
- Vue 4 suppport? HOT 2
- Use vue-toaster inside action.js HOT 6
- Should be used with Vue3 Typescript HOT 3
- ReferenceError glob is not defined
- Add separate close button HOT 2
- Publish latest release to npm HOT 1
- @meforma/vue-toaster doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module HOT 1
- Warnings when installing?
- Cannot read properties of undefined (reading '$toast') HOT 3
- Custom CSS HOT 3
- Calling this.$toast.clear() doesn't clear any toasts (using Vite) HOT 7
- Why the toaster doesn't show up on mobile browsers?
- Is there a way to change the toast colors? HOT 2
- Unable to build the site HOT 1
- Import not work in main.js
- Different mounting point HOT 1
- Simple Import in app.js not working Vue3 /Inertia
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-toaster.