Я пытаюсь сохранить ответ от API в методе asyn c моего приложения Nuxt js в переменной info
. Я получаю эту ошибку: Property 'info' does not exist on type 'Vue'
. Если я вставлю тот же вызов Ax ios в смонтированный, ошибки не будет. Вот что у меня есть:
<template>
<div>
{{ info }}
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import axios from 'axios';
@Component({
async asyncData(): Promise<any> {
await axios
.get('https://api.coindesk.com/v1/bpi/currentprice.json')
.then(response => (this.info = response)); <--- The error is here
},
})
export default class MainClass extends Vue {
info: any = null;
....
}
</script>
Буду признателен за помощь, спасибо!