|
|
- "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
|