天天看点

axios基础(三):axios的常用基础配置

常用基础配置

// axios的常用默认配置
axios.defaults.method = 'GET';
axios.defaults.baseURL = 'http://localhost:3000';
axios.defaults.params = {id: 2};

btns[0].onclick = function() {
    axios({
        url: '/posts'
    }).then(response => {console.log(response);})
}
      
axios基础(三):axios的常用基础配置

继续阅读