/*用mock模拟*/
Mock.mock('http://test.advance.ai/login',(options)=>{
console.log(options);
return Mock.mock({
"username":"admin",
"password":123456
})
Mock.mock('http://test.advance.ai/login',(options)=>{
console.log(options);
return Mock.mock({
"username":"admin",
"password":123456
})
});
使用axios
axios.post('http://test.advance.ai/login',{
"username":this.username,
"password":this.password
}).then(function(res){
if(this.username == res.data.username && this.password == res.data.password){
this.loginMsg = '登陆成功!1111'
Indicator.close();
this.popupVisible = true;
}else{
this.loginMsg = '帐号密码错误'
this.popupVisible = true;
Indicator.close();
}}.bind(this)).catch((err)=>{
console.log(err);
})