how to call api in vue from external js file code example
Example 1: how to use api url in vue
<a :href="post.url" target="_blank"><img :src="post.image_url"></a>
Example 2: import api vue and html
new Vue({
el: '#app',
data () {
return {
info: null
}
},
mounted () {
axios
.get('https://api.coindesk.com/v1/bpi/currentprice.json')
.then(response => (this.info = response))
}
})