[Vuejs]-Axios fetch json data using vue

0👍

Without any plugin.

var app = new Vue({
el: ‘#app’,

// YOUR DATA HERE
data: {
    filterResult: [] // THIS IS YOUR JSON FILE
},

// READY FUNCTION HERE
created: function() {
    this.filterResult = this.dataResult();
},

// YOU FUNCTION HERE
methods: {
    // CALLING API
    dataResult: function() {
        $.getJSON('/api/feature/stores/list', function(json) {
            app.results = json;
            app.filterResult = json;
        });
    },
}

});

Leave a comment