vue-toaster icon indicating copy to clipboard operation
vue-toaster copied to clipboard

Use vue-toaster inside action.js

Open woutervanerp opened this issue 4 years ago • 6 comments

For a project i'm using vuex actions. Inside the .js file i get the error: TypeError: Cannot read property '$toast' of undefined

How do i solve this issue?

woutervanerp avatar May 19 '21 15:05 woutervanerp

Hi @woutervanerp, Have you found a solution?

meirroth avatar Jun 08 '21 22:06 meirroth

Nope, i stated using Vue Toastification (for Vue 3). Which uses:

import { useToast } from 'vue-toastification'

const toast = useToast()

woutervanerp avatar Jun 09 '21 12:06 woutervanerp

Awesome! Thank you :)

meirroth avatar Jun 10 '21 16:06 meirroth

@woutervanerp @meirroth It's now possible to import vue-toaster anywhere (js files, vuex, ...) and use it.

Explained in the updated readme: https://github.com/MeForma/vue-toaster#import

Please close this issue if this solves what you were trying to do.

mesqueeb avatar Oct 12 '21 00:10 mesqueeb

Is this latest version (1.3.0) not available via Yarn? It seems only up to 1.2.2 is available, yet GitHub has up to 1.3.0.

https://www.npmjs.com/package/@meforma/vue-toaster https://github.com/MeForma/vue-toaster/commit/358d6c24d62219df1c3a3445298fdf86c45a0696

baka-san avatar Nov 15 '21 07:11 baka-san

@jprodrigues70 can you double check the npm version?

mesqueeb avatar Nov 16 '21 10:11 mesqueeb