[Vuejs]-Call a json from a list when loading page in Vue

1👍

You can use the fetch API in the mounted property :

    let app = new Vue({
        el: '#app',
        mounted: {
            fetch('your json url', ...params)
              .then(res => res.json())
              .then(json => {
                 this.json = json
                })
        },
        data: {
          json: {}
        }
    })

0👍

On created you can make an api call and on success of that api call you can set store information of the first item.
created () hook
Let me know if it works
Thanks 🙂

Leave a comment