vue+post+get
// 1、直接使用axios发起get请求
document.querySelector('#btn1').addEventListener('click', function() {
axios({
method: 'GET',
url: '',
params: {
}
}).then(function(res) {
console.log(res.data);
})
})
// 2、直接使用axios发起post请求
document.querySelector('#btn2').addEventListener('click', function() {
axios({
method: 'POST',
url: '',
data: {
}
}).then(function(res) {
//dosomething
})
})
vue不支持ajax,使用独有的axios与后端交互

浙公网安备 33010602011771号