我是靠谱客的博主 现实水池,这篇文章主要介绍关于本地Mock测试api的使用规则,现在分享给大家,希望可以做个参考。

/*用mock模拟*/
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);
})

最后

以上就是现实水池最近收集整理的关于关于本地Mock测试api的使用规则的全部内容,更多相关关于本地Mock测试api内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(95)

评论列表共有 0 条评论

立即
投稿
返回
顶部