Vue axios

instalacja:

npm install axios --save -dev

użycie w template:

    <div class="" v-for="post in posts" :key="post.id">
      <h3>{{ post.title }}</h3>
      <p>{{ post.body }}</p>
    </div>

użycie w script

import axios from 'axios'
  export default {
    name: 'Blogs',
    data() {
      return {
        posts: []
      }
    },
    methods: {
    },

    created() {
      axios.get('https://jsonplaceholder.typicode.com/posts/')
      .then(response => {
        this.posts = response.data;
      }).catch(err => {
        console.log('this is an error: ',err);
      })
    },
  }