ankurk91 / vue-loading-overlay

Vue.js component for full screen loading indicator :cyclone:
https://ankurk91.github.io/vue-loading-overlay/
MIT License
1.24k stars 101 forks source link

Vue3 - Use loader instance in store or router #92

Closed webmastervinay closed 2 years ago

webmastervinay commented 3 years ago

This is not a issue. Its question or feature request (if not available)

Your documentation mentions that it can be used inside any component or via composition api. Glad it support both.

I couldn't find a way where it can be used inside store or router. I tried following:

but it broke the code and showing errors in console.

Current behavior

import { useLoading} from 'vue-loading-overlay'
const $loading = useLoading()

image

ankurk91 commented 3 years ago

Search for useLoading in the dist file https://unpkg.com/browse/vue-loading-overlay@4.0.4/dist/vue-loading.js

webmastervinay commented 3 years ago

Yes, I am using latest version of your package but getting the same error. Tried rm -rf node_modules but could not solve.

image

There is also useLoading function available in the said file:

image

ankurk91 commented 3 years ago

i will try this in my project and let you know soon,

ankurk91 commented 3 years ago

This is strange, i thought i have fixed the export issue last week, but it still there. https://github.com/ankurk91/vue-loading-overlay/issues/88

Created a fiddle to see the issue in browser https://codesandbox.io/s/async-star-xmp65?file=/src/App.vue

leture commented 3 years ago

Hi,

I am also having problems with importing and using useLoading. During my debugging I saw that useLoading is in the dist file but not in types/loading.d.ts. Maybe this is part of the problem? I am using it in a project with TypeScript usage.

Greetings

tbrains commented 2 years ago

Facing the same issue, any updates?

Thank you

ankurk91 commented 2 years ago

I am planning to use rollup for bundling since webpack does not support named-export. There is no ETA.

ankurk91 commented 2 years ago

Please follow this issue now https://github.com/ankurk91/vue-loading-overlay/issues/88

ankurk91 commented 2 years ago

This has been fixed with v5

npm install vue-loading-overlay@5.0.0