Skip to content
Discussion options

You must be logged in to vote

Using axios in nuxt.js

`

{{ articleList }}
<script> export default { async asyncData({ app }){ //获取文章列表数据 let article = await app.$axios.get(`http://localhost:3000/article/list`) return {articleList: article.data.data} } methods: { async fetchSomething() { const res = await this.$axios.get('http://localhost:3000/article/list') this.data = res } } } </script>

`

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by xiao-ice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants