BinarCode / vue-form-wizard

Vue.js 2 wizard
https://binarcode.github.io/vue-form-wizard/#/
MIT License
1.11k stars 243 forks source link

Lazy loading issue #356

Open abliGhtS opened 3 years ago

abliGhtS commented 3 years ago

I have two differents routes in my wizard. Route A and B. They're separated by if condition. All of the steps are lazy-loaded (or at least I want them to be), because I don't want to load all components of path A is someoone chooses path B.

My vue-wizard looks like this

 <form-wizard >
    <tab-content>
        <step1 />
    </tab-content>
    <tab-content :lazy="true"
                 v-if="versionA"
    >
        <step2A/>
    </tab-content>
    <tab-content :lazy="true" 
                 v-else>
        <step2B />
    </tab-content>
    <tab-content :lazy="true"
                 v-if="versionA">
        <step3A/>
    </tab-content>
    <tab-content :lazy="true"
                 v-else>
        <step3B/>
    </tab-content>

</form-wizard>

But when I print logs in mounted() of each of the components, I can see that whole route B is loaded at once. Same issue with lazy-loading appears even in simplest example. Unless I'm using it incorrectly?

BRafols commented 3 years ago

Yes, components get mounted but the rendered HTML should be empty.

hex20 commented 3 years ago

This is a real pain because It will be mounted but without the HTML things like this.$ref will throw undefined errors

BRafols commented 3 years ago

You can always choose to not use "lazy-loading", would that fit your case?

mreduar commented 3 years ago

I have relied on this and realized that the package I just downloaded does not have this feature #316 in its source code.

vesper8 commented 3 years ago

@MrEduar thanks a lot for pointing that out.. I was wondering why the lazy flag seemed to make no difference

The last release is more than 3 years old.. 31 commits since the last release

But you can get all the latest commits by installing it like this in your package.json:


"vue-form-wizard": "git://github.com/binarcode/vue-form-wizard.git#4ba261a",
sadortun commented 3 years ago

AHHHHHH ! This explain so many things !!!!!

@fabdbt @BRafols @cristijora Can you please make a new release on master ?

Thanks