爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
1.1 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const pullRefreshMixin = {
data() {
return {
isRefreshing: false
};
},
methods: {
async refreshData() {
if (this.isRefreshing)
return;
this.isRefreshing = true;
try {
if (typeof this.onRefresh === "function") {
await this.onRefresh();
} else {
await new Promise((resolve) => setTimeout(resolve, 1e3));
}
common_vendor.index.showToast({
title: "刷新成功",
icon: "success"
});
} catch (error) {
common_vendor.index.__f__("error", "at pages/mixins/pullRefreshMixin.js:26", "刷新失败:", error);
common_vendor.index.showToast({
title: "刷新失败",
icon: "none"
});
} finally {
this.isRefreshing = false;
common_vendor.index.stopPullDownRefresh();
}
}
},
onPullDownRefresh() {
this.refreshData();
}
};
exports.pullRefreshMixin = pullRefreshMixin;
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mixins/pullRefreshMixin.js.map