Skip to content

Instantly share code, notes, and snippets.

@flowck
Created May 27, 2018 10:42
Show Gist options
  • Save flowck/e393ff3857875635286002e88545a252 to your computer and use it in GitHub Desktop.
Save flowck/e393ff3857875635286002e88545a252 to your computer and use it in GitHub Desktop.
<script>
const vueapp = new Vue({
el: '#vueapp',
data() {
return {
posts: []
};
},
created() {
const API_POSTS = 'https://jsonplaceholder.typicode.com/posts';
fetch(API_POSTS, {method: 'GET'})
.then(res =>; res.json())
.then(json =>; {
this.posts = json;
})
.catch(err =>; console.log(err));
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment