SeregPie / VueWordCloud

Generates a cloud out of the words.
https://seregpie.github.io/VueWordCloud/
MIT License
386 stars 60 forks source link

Still having issue with re-render when using circular progress #62

Closed ogmo0n closed 1 year ago

ogmo0n commented 1 year ago

When I use a loading spinner (circular progress), rendering of the word cloud takes twice as long. What is the proper way to watch the progress event from the component to hide a spinner upon completion??

ogmo0n commented 1 year ago

I may have found a workaround. I dug through the code and found another event -> update:cloudWords. When I log the event value in an event handler, it logs an empty array initially, then a filled array once the word cloud renders. If I do I check in the event handler function for the length of the returned array and change my loading variable for the v-if in the spinner, I get equal load times with and without.

In the component use @update:cloudWords="updateHandler"

initialize in script with const loading = ref(true);

and in your handler do const updateHandler = (e) => { console.log(e); if (e.length) loading.value = false; };