I try to load data from Json to vue component using this tutorial:
https://nuxtjs.org/guide/async-data/
This is my code:
<li class="item" v-for="post in posts" v-bind:key="post.id">
<nuxt-link :to="....">
{{post.id}}. {{post.title}}
</nuxt-link>
</li>
import axios from "axios";
export default {
async data () {
let { data } = await axios.get(`http://jsonplaceholder/`)
return { posts: data } // Console: property post is not defined
}
}
Tell me please, what's wrong?
async asyncDatainstead ofasync data.