常用基础配置
// 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.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);}) }