我使用fetch方法nuxt/axios发送post请求来获取特定类别
async fetch() {
const res = await this.$axios.post(
`https://example.com/art-admin/public/api/get_single_cat_data_and_posts?cat_id=${params.id}`,
{
headers: {
Accept: "application/json",
"Content-Type": "application/json"
}
}
);
this.categoryData = JSON.parse(JSON.stringify(res.data.Data));
},
有没有另一种方法可以使用带参数的post请求来获取数据
发布于 2021-03-28 21:55:56
要访问有关当前路线的信息,您应该调用$route对象。
如果你想访问传递到URL中的参数,那么你应该访问$route.query
。
因此,在您的情况下,您应该尝试将某些东西称为line
`https://example.com/art-admin/public/api/get_single_cat_data_and_posts?cat_id=${this.$route.query.id}`,
https://stackoverflow.com/questions/66842025
复制相似问题