FranckFreiburger / http-vue-loader

load .vue files from your html/js
MIT License
1.48k stars 273 forks source link

"Pending components loaded" event #118

Closed dmikam closed 3 years ago

dmikam commented 3 years ago

Hi,

Shortly - it would be nice to have some kind of event/callback to trigger after all "pending" components are mounted.

Longer story: Usually, to execute something after all "pending" (not conditinal) application components are loaded you would do something like this:

const app = new Vue({....
    .....
    mounted: function(){
        this.$nextTick(function(){
            // gere gose code executed after ALL components are mounted
        });
    }

(here is the official doc describing this behaviour: https://vuejs.org/v2/api/#mounted)

But when you use httpVueLoader to load those components - this doesn't work anymore, so it would be greate to have something like this:

const app = new Vue({....
    .....
    mounted: function(){
        httpVueLoader.allComponentsLoaded(function(){
            // gere gose code executed after ALL components are mounted
        });
    }
FranckFreiburger commented 3 years ago

Maybe vue3 will provide such feature. see https://v3.vuejs.org/guide/migration/async-components.html#async-components see https://github.com/vuejs/vue/issues/9416