前端数据调用接口问题
getSource() {
console.log("1111");
var vm = this;
vm.$http
//这个post里面就是要调用的接口
//下面的字段就是要通过什么数据查询
.post("具体调用的接口", {
接需要的字段名: "字段",
})
.then((response) => {
console.log("返回的数据", response.data);
switch (response.code) {
case "0000":
this.student = response.data;
console.log(this.student);
break;
case "1111":
console.log("查询失败");
break;
}
});