与vue-resource使用过程一致
1.下载
npm install axios --save
2. 引入模块
import axios from 'axios'
3. 发送请求
axios.get(url).then(response => { // 成功了 const result = response.data const mostRepo = result.items[0] this.repoUrl = mostRepo.html_url this.repoName = mostRepo.name }).catch(error => { alert('axios请求失败') })