<el-button type="primary" @click="queryStudents">查询</el-button>
inputStr: '',
//实现学生信息查询
queryStudents() {
//使用Ajax请求--POST-->传递InputStr
let _this = this
//开始Ajax请求
axios
.post(
_this.baseURL + "students/query/",
{inputstr: _this.inputStr,}
)
.then(function (res) {
if (res.data.code === 1) {
//把数据给students
_this.students = res.data.data;
//获取返回记录的总行数
_this.total = res.data.data.length;
//获取当前页的数据
_this.getPageStudents();
//提示:
_this.$message({
message: '查询数据加载成功!',
type: 'success'
});
} else {
//失败的提示!
_this.$message.error(res.data.msg);
}
})
.catch(function (err) {
console.log(err);
_this.$message.error("获取后端查询结果出现异常!");
})
}
},
14信息查询-前端请求
最新推荐文章于 2024-07-22 15:19:55 发布