Created
May 27, 2018 10:42
-
-
Save firminochangani/e393ff3857875635286002e88545a252 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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