在Login.vue内使用:
login(){
this.$refs.loginFormRef.validate(async(value)=>{
// console.log(value)if(!value)return;// this.$http.post("login", this.loginForm)// const result = await this.$http.post("login", this.loginForm)// only get data , and alias data to resconst{
data: res }=awaitthis.$http.post("login",this.loginForm)// console.log(result)// console.log(res)// deal with res and print infomationif(res.meta.status !=200)return console.log("login fail");
console.log("login success")});}},
体现:this.$http.post("login",this.loginForm)
调用post方法
接口url:http://127.0.0.1:8888/api/private/v1/login
参数:this.loginForm--> 登录的账号密码