Created
May 27, 2018 15:56
-
-
Save donvito/88e69ce0b3872ac5a0b93d3cb4937b12 to your computer and use it in GitHub Desktop.
Query GitHub API repos using Vue.js
This file contains 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 src="https://unpkg.com/vue"></script> | |
<div id="githubRepos"> | |
</div> | |
<script> | |
new Vue({ | |
el: '#githubRepos', | |
data: { | |
repos : [], | |
}, | |
mounted(){ | |
fetch("https://api.github.com/users/donvito/repos") | |
.then(response => response.json()) | |
.then((data) => { | |
this.repos = data; | |
}) | |
}, | |
template: ` | |
<div> | |
<li v-for="repo in repos"> | |
{{ repo.name }} | |
</li> | |
</div> | |
` | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment