[Vuejs]-VueJS & Laravel: A bunch of empty rows when using v-for on a table

2👍

i think you should set the initial files data as an empty array not null because v-for will render a list based on an array. read here .

0👍

So using the Vue Dev Tools I saw that my JSON Output was escaped in the files array.

I used a $.parseJSON like so:

new Vue({
        el: '#fileTable',

        data: {
            files: [],
            filesAreReady: false
        },

        created: function(){
            this.fetchData();
        },
        methods: {
            fetchData: function(){
                var self = this;
                $.get(url, function(data){
                self.files = $.parseJSON(data);
                self.filesAreReady = true;
            });
        }
    }
});

Now it works.

Leave a comment