question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vue-3] Make useToast available from import

See original GitHub issue

I’m submitting a …

[ ] Bug report => search github for a similar issue or PR before submitting
[x] Feature request
[ ] Other, please describe

Tell about your platform

  • Vue.js version : 3.0.x
  • This package version : next

Current behavior The $toast object is only available in components, not from imports.

Expected behavior I would be nice to have useToast available for in .ts files - for instance in Vuex.

example.ts

import { useToast } from "vue-toast-notification";

useToast.success("Hello world.");

It should be as simple matter of exporting { useToast } in index.js and changing the .d.ts file.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ankurk91commented, Aug 29, 2021

fixed with 2.0.1

1reaction
ankurk91commented, Aug 23, 2021

Looks like webpack is removing un used exports from bundle

https://unpkg.com/browse/vue-toast-notification@2.0.0/dist/index.js

Need to find a way to prevent this

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create reusable toastService with primeVue toast?
Second: import app and use toast service with app.config. ... still work (until build time where another solution should be found) const key ......
Read more >
How to use toast notification with Vue 3 and Laravel | Part 10
If you are interested to work with me then please email me at: channel.clovon@gmail.comYou can support the growth of this channel by ...
Read more >
vue-toast-notification - npm
import Vue from 'vue'; import VueToast from 'vue-toast-notification'; // Import one of the available themes //import ...
Read more >
Vue.js toast notification plugin for vue 3
Vue Toaster · Installation · Import · Usage · Available options · API methods · Global options · How to execute example.
Read more >
Vue Toast Component - PrimeFaces
$toast is available as a property in the application instance. ... import { defineComponent } from "vue"; import { useToast } from "primevue/usetoast"; ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found