import { axios } from '@/utils/request'//axios在request下封装的
export function count(data) {
return axios({
url: "/admin/reserve/report/count",
method: "post",
data: data
});
}//这是report中封装的 count axios 方法
import { count } from "@/api/report";//count 封装了axios
//download是一个点击方法
async download() {
await count(this.tableDate).then((res) => {
if (res.data != 0) {
} else {
this.$message({
type: "error",
message: "数据为空",
});
}
});
alert("现在是同步机制没收到响应不弹出");
},
记录一下vue axios 同步机制
最新推荐文章于 2023-08-05 10:58:59 发布
本文介绍了如何在vue项目中通过axios封装count方法,处理/admin/reserve/report/count接口请求,并展示了在download方法中使用该封装的示例,当接口返回数据不为空时进行相应操作,否则显示错误消息。
摘要由CSDN通过智能技术生成