Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Last active January 19, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/bbf5872d95e405ab14fe76564e3d6979 to your computer and use it in GitHub Desktop.
Save uno-de-piera/bbf5872d95e405ab14fe76564e3d6979 to your computer and use it in GitHub Desktop.
<template>
<div>
<h2>Listado de usuarios</h2>
<ul v-if="users.length">
<li v-for="user in users" :key="user.id">
{{ user.name }} - {{ user.email }}
</li>
</ul>
<p v-else>No hay usuarios disponibles</p>
</div>
</template>
<script>
export default {
name: "UsersList",
async mounted() {
const response = await fetch("https://jsonplaceholder.typicode.com/users");
this.users = await response.json();
},
data() {
return {
users: []
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment