This is probably a very silly question, but believe me I have tried hard to figure it out, to no avail.
I have an appService.js file where I call an API like so:
import axios from 'axios'
axios.defaults.baseURL = 'https://www.alphavantage.co'
const appService = {
getPosts() {
axios.get(`/query?function=TIME_SERIES_INTRADAY&symbol=MSFT&interval=5min&apikey=xxx`)
.then(response => this.info = response)
}
}
export default appService
and then I have a Vue component (Stocks.vue) where I want to display {{ info }} like so:
<template>
<div>
<h4>{{ info }}</h4>
</div>
</template>
<script>
import appService from '../app.service.js'
export default {
name: 'Stocks',
props: {
msg: String
},
}
</script>
I literally just want to dump everything I get from the API in that tag. I will figure the rest out later.
I am basically doing the simple Axios example from the Vue docs, but using a component instead. (https://v2.vuejs.org/v2/cookbook/using-axios-to-consume-apis.html#Base-Example)
Hope that makes sense!
Thanks in advance
{{info}}.