axios中get请求传参
时间: 2023-10-13 20:06:34 浏览: 177
在axios中,可以使用三种方式进行get请求传参。第一种方式是将参数直接拼接在地址栏中进行传递。比如:axios.get('http://localhost:3000/axios?id=123')。第二种方式是将参数放在一个对象中,作为params属性的属性值进行传递。比如:axios.get('http://localhost:3000/axios', {params: {id: 789}})。第三种方式是将参数放在一个对象中进行传递。比如:axios.get('http://localhost:3000/axios/123', {params: {id: 789}})。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [axios请求数据](https://blog.csdn.net/weixin_43709908/article/details/103435367)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [axios(get、post) 请求中的@requestBody @requestParams 以及headers的使用,请求拦截器、响应拦截器的...](https://download.csdn.net/download/weixin_38569569/14015985)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文