Last active
October 13, 2018 12:03
-
-
Save mfaridzia/12c2dea8b9b02ae7c7340690da4ba3b6 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> | |
<h1> {{ name.toUpperCase() }} </h1> | |
<p> Symbol : {{ coin.symbol }} </p> | |
<p> Rank : {{ coin.rank }} </p> | |
<p> Price USD : {{ coin.price_usd }} </p> | |
</div> | |
</template> | |
<script> | |
import axios from 'axios' | |
export default { | |
async asyncData ({params}) { | |
const { data } = await axios.get(`https://api.coinmarketcap.com/v1/ticker/${params.coin}/`) | |
return { coin: data[0], name: params.coin } | |
} | |
} | |
</script> | |
<style scoped> | |
div { | |
margin-top:30px; | |
} | |
</style> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment