Created
February 8, 2018 19:50
-
-
Save mfaridzia/d80c45f396e15cb11f71e727fe8c78aa to your computer and use it in GitHub Desktop.
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
<template> | |
<div class="container"> | |
<nuxt-link v-for="coin in coins" :key="coin.id" class="list-data" :to="'/coins/'+coin.id"> | |
{{ coin.name }} | |
</nuxt-link> | |
</div> | |
</template> | |
<script> | |
import axios from 'axios' | |
export default { | |
async asyncData() { | |
const { data } = await axios.get('https://api.coinmarketcap.com/v1/ticker/') | |
return {coins: data} | |
} | |
} | |
</script> | |
<style scoped> | |
.container { | |
width: 75%; | |
margin: 50px auto; | |
text-align: center; | |
} | |
.list-data { | |
background: #ddd; | |
display: inline-block; | |
margin:10px; | |
padding:10px; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment