// 方法一 post
this.axios({
url : url,
method: 'POST',
// data : $.param({username:this.username,password:this.password}),
// //$.param()的含义:序列化对象,返回字符串 用form表单传递数据
// headers: {'BsmAjaxHeader': true}
dataType:JSON,
data:{username:this.username,password:this.password} //json格式
}).then(res=>{
console.log(res)
if(res.data.success == true){
alert(res.data.message)
this.$router.push({path: '/details'});
}else{
alert(res.data.message)
}
})
// 方法二 get
// this.axios.get(url,{params:{username:this.username,password:this.password}}).then(res=>{
// this.axios.get(url,{params:{"username":this.username,"password":this.password}}).then(res=>{
// // console.log(this.username)
// // console.log(this.password)
// console.log(res.data)
// if(res.data == 0){
// this.$router.push({path: '/index'});
// }else{
// alert("登录失败")
// }
// })
// 方法三 json格式传递
// var obj = {username:this.username,password:this.password} /* url传递参数*/
// this.axios.post(url,obj).then((res)=>{
// // this.axios.post(url,this.qs.stringify(obj)).then((res)=>{ url传递参数后端对象格式接收
// console.log(res)
// if(res.data == 0){
// this.$router.push({path: '/index'});
// }else{
// alert("登录失败")
// }
// })