desandro / masonry

:love_hotel: Cascading grid layout plugin
https://masonry.desandro.com
16.38k stars 2.11k forks source link

masonry not show correct result when first time DOM element appended with vueJs #1065

Closed kiwionly closed 6 years ago

kiwionly commented 6 years ago

Hi,

I am using Mansonry with VueJs for display item, some how encounter strange behavior when run it, not sure whether is vuejs issue or masonry.

here the test cases, it should ideally, show 2 element align to left when new item, any idea ? Test case: https://codepen.io/kiwionly/pen/KxNEQE

kiwionly commented 6 years ago

seem like is related to timing issue.

I put a timer when called layout(), it work (but kind of cheating? ), any better solution ?

kiwionly commented 6 years ago

seem like I need to use tick() function instead.

Vue.nextTick(()=> { this.layout(); })