V
V
Vanya Huk2017-09-30 17:52:34
Vue.js
Vanya Huk, 2017-09-30 17:52:34

Why doesn't vue-masonry plugin work after ajax request?

After installing the vue-masonry plugin, everything worked fine until it was unnecessary to update the list of articles with an ajax request.
here is the vue.js component code

<template>
    <div class="grid-container">
        <div v-masonry transition-duration="0.3s" item-selector=".item">
            <div v-masonry-tile class="item col-lg-3 col-md-3 col-sm-12 col-xs-12" v-for="article in articles">
                test
            </div>
        </div>
    </div>
</template>
<script>

export default{

    data : function () {
        return {
            articles : {}
        }
    }, 
    
    mounted : function () {

        this.get_articles()

    },


    methods : {

        get_articles : function () {

            this.$http.post( window.location.origin + window.location.pathname ).then(response => {

                this.articles = response.body;

        },response => {});
        }

    }

}
</script>

when instead of v-for="article in articles" I write v-for="article in 10" everything works
here is a link to the repository

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2017-09-30
@kulakoff Vue.js

Judging by the dock, this thing should be called when changing elements: this.$redrawVueMasonry()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question