javascript - Vue.js Snotify - 异步触发多个调用
问题描述
以下是我使用 axios 调用远程调用的代码,并根据服务器错误或成功通知中的错误类型向用户显示。这是原始文档的链接。
async getResponseFromServer() {
if (this.errors.all().length == 0) {
this.$snotify.clear();
this.$snotify.async(
"Getting Data",
"Loading...",
() =>
new Promise((resolve, reject) => {
return this.getDataCommonResponse()
.then(function(response) {
if (response.status && response.type == undefined) {
resolve({
title: response.error,
body: "This is the balance",
config: {
closeOnClick: true,
position: SnotifyPosition.centerTop
}
});
} else {
reject({
title: "Error",
body: response.error,
config: {
closeOnClick: true,
position: SnotifyPosition.centerTop
}
});
}
})
.catch(function(error) {});
})
);
}
}
在 GitHub 中也有一个未解决的问题。它说 Snotify 将进行 2 次 API 调用,但会发出多个请求。有没有办法限制单个 API 调用?
有没有办法来解决这个问题?
解决方案
推荐阅读
- prolog - Prolog程序firstlast没有递归?
- java - Netty 中捕获异常和转入异常
- file - 按名称搜索文件夹中的多个文件并将它们复制到其他文件夹
- python - 在不使用所有内存的情况下将图像保存到磁盘
- php - PHP 在提交联系表单错误后发送电子邮件 POST http://www.if.com/mail/mail.php 404 (Not Found) - jquery-3.1.1.min.js:4
- json - 如果提取为空,则 Wikipedia-API 回退
- python - 在 Dataframe 中查找每行都有一个值的列
- metrics - 在 Dropwizard 指标中获取自定义持续时间的吞吐量
- deployment - 部署时 TeamCity 中 BuildConfiguration 之间的依赖关系
- python-2.7 - 如何使用 python 脚本在 Azure 上创建 mysql 服务器