axios全局配置

时间:2020-12-30 10:59:44   收藏:0   阅读:0
<script>
    axios.defaults.baseURL=‘http://localhost:8080/student‘;//配置全局属性
    axios.defaults.timeout=10000;//超时10s
    axios.get(‘getAllstudent‘).then(res=>{//在全局配置基础上去网络请求
        console.log(res);
    })
</script>

  

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!