2025-07-15 16:18:34 +08:00

54 lines
2.0 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
const _easycom_hs_cell2 = common_vendor.resolveComponent("hs-cell");
_easycom_hs_cell2();
}
const _easycom_hs_cell = () => "../hs-cell/hs-cell.js";
if (!Math) {
_easycom_hs_cell();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "hs-date-picker",
props: ["valueModel", "tip", "title", "hasFutureDate", "borderTop", "isLink"],
emits: ["change", "update:valueModel"],
setup(__props, { emit }) {
const props = __props;
const dateValue = common_vendor.ref("");
const startDate = common_vendor.ref("");
const endDate = common_vendor.ref("");
const onChange = (e) => {
dateValue.value = e == null ? void 0 : e.detail.value;
emit("update:valueModel", e == null ? void 0 : e.detail.value);
emit("change", e == null ? void 0 : e.detail.value);
};
common_vendor.onMounted(() => {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
month = month > 9 ? month : "0" + month;
day = day > 9 ? day : "0" + day;
startDate.value = (props == null ? void 0 : props.hasFutureDate) ? `${year}-${month}-${day}` : `${year - 60}-${month}-${day}`;
endDate.value = `${year + 60}-${month}-${day}`;
});
return (_ctx, _cache) => {
return {
a: common_vendor.p({
title: (props == null ? void 0 : props.title) || "选择日期",
borderTop: props == null ? void 0 : props.borderTop,
value: dateValue.value,
isLink: props == null ? void 0 : props.isLink,
isPlaceholder: true
}),
b: props.valueModel,
c: common_vendor.o(onChange),
d: startDate.value,
e: endDate.value
};
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/components/hs-date-picker/hs-date-picker.vue"]]);
wx.createComponent(Component);