// 网络请求
axios.get("http://127.0.0.1:8080")
.then(
function(response){ // 成功的回调函数
},
function(err){ // 失败的回调函数
}
)
// 结合vue 使用
var app=new Vue({
el:"#app",
data:{
name:"admin"
},
methods:{
getUserInfo:function(){
let that=this
axios.get("http://127.0.0.1:8080")
.then(
function(response){ // 成功的回调函数
that.name="user"
},
function(err){ // 失败的回调函数
}
)
}
}
})