Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with <transition-group> #6

Open
longnt80 opened this issue Dec 24, 2017 · 10 comments
Open

Using with <transition-group> #6

longnt80 opened this issue Dec 24, 2017 · 10 comments

Comments

@longnt80
Copy link

How do I use this with transition-group? I tried with masonry as the component:

<transition-group tag="masonry"

but the gutter didn't work, the cols didn't have the gutter as defined.

@paulcollett
Copy link
Owner

paulcollett commented Dec 29, 2017

This would be a great feature @longnt80.

I originally couldn't get <transition-group> working without a more thorough understanding of vue's renderer and workarounds. I haven't seen the tag="*component*" approach before but this might be worth exploring as a solution without a lot of workarounds

@TheFrankman
Copy link

TheFrankman commented Jan 31, 2018

@paulcollett - I too got it working using the component tag but that meant that set cols doesn't work. Any chance you got anywhere with resolving this. This is my first Laravel/Vue project so I can't offer much help.

<transition-group name="items" tag="masonry">
                <div class="item" v-for="(item, index) in items" :key="index">
                    <img v-show="item.show" :src="item.src">
                </div>
</transition-group>

@paulcollett
Copy link
Owner

@TheFrankman no new update from me as of yet but still thinking this would be a good addition to look into. How did you get on?

@mandofever78
Copy link

+1 any solution for this?

@ChibiChanNya
Copy link

+1 I am having lots of issues animating Vuetify cards using this.

@Afondevi
Copy link

UP !!!

@ChibiChanNya
Copy link

UP !!!

... What's that supposed to mean?

@Afondevi
Copy link

Hum.. waiting for solution..

@Cweet
Copy link

Cweet commented Jul 10, 2019

Hi all!
I made a solution that works pretty nicely for me, so I figured I'd share until the bug is fixed :) Instead of using transition groups I use the normal transition element.

So I have to wrap each element inside the for-loop with the transition. This means I can't put any styling on the loop-element, and I have to put styling on the inner elements instead. So you'll need an extra wrapper for this.

<masonry class="image-grid" :cols="4" :gutter="30" >
    <div class="images-item" v-for="(image, index) in images" :key="image.id" :data-index="index" :data-id="image.id">
        <transition v-on:before-enter="beforeEnter" v-on:enter="enter" appear>
            <div class="frame"><img :src="image.url" /></div>
        </transition>
    </div>
</masonry>

I used .js animation instead of classes. Then I set an index in my data array and I increase that on the enter hook to delay the animation of each item.

enter: function (el, done) {
    var delay = 100 * this.index;
    this.index = this.index + 1;
    
    setTimeout(function () {
            Velocity(
               el, 
               { opacity: 1 ,
               transform: ["scale(1)", "scale(0.9)"] },
	    );
    }, delay );

}

Unfortunately I don't have a demo to show, as I am working locally right now.. but it works fine on my side with both the transitions and the columns.

Hope this helps someone!

Just an fyi: my particular case was an image gallery, so I also had some functions for rendering the image before animation, but I took it out of the example to stay on topic. So this example would have laggy images.

@TiagoJose
Copy link

TiagoJose commented Mar 2, 2020

+1 Any solution for this yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants