vue axiosget请求
时间: 2023-09-13 08:04:03 浏览: 123
在Vue中使用axios进行GET请求的步骤如下:
1. 全局引入axios:首先,在项目的main.js文件中引入axios,并将其设置为Vue的原型属性。可以使用以下代码实现:
```javascript
import axios from 'axios'
Vue.prototype.$http = axios
```
这样,就可以在项目的任何地方通过`this.$http`来使用axios进行请求了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [在vue-cli里面使用axios发送get和post请求](https://blog.csdn.net/Sheep000000/article/details/119187407)[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%"]
- *2* *3* [Vue的axios请求(get请求)](https://blog.csdn.net/Stark0118/article/details/106753178)[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 ]
阅读全文