K
K
Konstantin2019-06-18 17:37:37
Vue.js
Konstantin, 2019-06-18 17:37:37

API not working in VUE js, how to fix?

Greetings, the second day I'm trying to connect the API to VUE.
Based on documentation https://ru.vuejs.org/v2/cookbook/using-axios-to-co...
Added code:

Vue.config.productionTip = false

new Vue({
  router,
  store,

  render: h => h(App),
  data() {
    return {
      info: null
    };
  },
  mounted() {
    axios
      .get('https://api.coindesk.com/v1/bpi/currentprice.json')
      .then(response => (this.info = response));
  }


})

.$mount('#app')

Added to the right place
<div id="app">
  {{ info }}
</div>

The console should receive a response that everything is OK. But the error:
5d08f6fd1cacb342181953.png
Before yesterday I tried to connect for lessons via VUE-resource, the same error ......

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Suha, 2019-06-18
@andreysuha

You need to install axios via npm and import it into the component. And then you want to call something that does not exist in the file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question