【发布时间】:2018-04-23 12:25:36
【问题描述】:
我将 Nuxt 与路由器模块一起使用 目前,我这样写api:
<template>
<div class="row flex">
{{posts.id}}
</div>
</template>
<script>
import axios from 'axios'
import Item from '~/components/feeds/Post.vue'
export default {
async asyncData ({ store, route }) {
let { data } = await axios.get('http://localhost:8000/api/v1/feeds/' + route.params.id + '/')
return {
posts: data
}
},
components: {
'post-detail': Item
}
}
</script>
【问题讨论】:
标签: vue.js vuejs2 vue-router nuxt.js