vue axios 使用方法
getData() { let apiUrl = 'http://s227.app1110631619.qqopenapp.com/api/getlist'; axios.get(apiUrl) .then(res => { console.log(res) }) .catch(err => { console.error(err); }); }, postData() { let apiUrl = 'http://s227.app1110631619.qqopenapp.com/api/postlist'; axios.post(apiUrl, { username: "张三" },{ headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'token': 'tk1234' } } ) .then(res => { console.log(res) }) .catch(err => { console.error(err); }); },