"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
  const _easycom_hs_empty2 = common_vendor.resolveComponent("hs-empty");
  const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
  (_easycom_hs_empty2 + _easycom_u_loading_icon2)();
}
const _easycom_hs_empty = () => "../hs-empty/hs-empty.js";
const _easycom_u_loading_icon = () => "../../node-modules/uview-plus/components/u-loading-icon/u-loading-icon.js";
if (!Math) {
  (_easycom_hs_empty + _easycom_u_loading_icon)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "hs-scroll-view",
  props: {
    meta: {
      type: Object,
      default: {}
      // 参数
    },
    showLoad: {
      type: Boolean,
      default: true
      // 是否显示加载状态
    }
  },
  emits: ["load"],
  setup(__props, { emit }) {
    const props = __props;
    const loadingStatusTest = common_vendor.ref("");
    const loadingStatus = common_vendor.ref(false);
    const params = common_vendor.ref({
      page: 1,
      perPage: 20
    });
    common_vendor.watch(
      () => {
        var _a;
        return (_a = props == null ? void 0 : props.meta) == null ? void 0 : _a.total;
      },
      () => {
        const { current_page, last_page } = props.meta;
        const hasNextPage = current_page < last_page;
        loadingStatus.value = hasNextPage;
        loadingStatusTest.value = hasNextPage ? "上拉加载更多" : "已经到底啦～";
        console.log(props == null ? void 0 : props.meta, "meta数据变化");
      }
    );
    const handleLoad = () => {
      const { current_page, last_page } = props.meta;
      const hasNextPage = current_page < last_page;
      loadingStatus.value = hasNextPage;
      loadingStatusTest.value = hasNextPage ? "上拉加载更多" : "已经到底啦～";
      if (hasNextPage) {
        params.value.page = current_page + 1;
        emit("load", params.value);
        setTimeout(() => {
          loadingStatus.value = false;
          loadingStatusTest.value = "";
        }, 1e3);
      }
    };
    return (_ctx, _cache) => {
      var _a, _b;
      return common_vendor.e({
        a: !((_a = props.meta) == null ? void 0 : _a.total)
      }, !((_b = props.meta) == null ? void 0 : _b.total) ? {} : common_vendor.e({
        b: common_vendor.p({
          text: loadingStatusTest.value,
          mode: "circle",
          size: "30rpx",
          show: loadingStatus.value
        }),
        c: !loadingStatus.value
      }, !loadingStatus.value ? {
        d: common_vendor.t(loadingStatusTest.value)
      } : {}), {
        e: common_vendor.o(handleLoad)
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6a6867ee"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-scroll-view/hs-scroll-view.vue"]]);
wx.createComponent(Component);
