-
Using axios in nuxt.js |
Beta Was this translation helpful? Give feedback.
Answered by
hixb
Jul 15, 2022
Replies: 1 comment
-
`
{{ 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>
` |
Beta Was this translation helpful? Give feedback.
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
`
`