一、get请求
leaveList({status:1}).then(res=>{
this.leaveExamineList=res.data;
console.log(this.leaveExamineList);
})
根据我们自己封装的api文档中的函数,将改模块引入到需要使用的组件页面,然后将调用该函数。其中 { status:1 } 是传过去的参数筛选条件,这个需要根据后台系统写的代码,来做参数筛选。
二、post请求
axios.post(
Config.baseUrl +
"post请求的接口",
datax_json //在用data数据绑定中,可以将需要传过去的数据封装在一个对象中,增加代码的可读性,减少工作量
)
.then(response => {
console.log(response);
}
});
三、页面跳转传值
- 传值:
jump(id){
this.$router.push({
path:'/Details',
name:'Details',
params: {
id:id //通过push传参对象中的params属性将需要传递的数据传过去
}
});
},
- 接收:
this.$route.params.id; //通过$route来接收传递过来的参数