UNPKG

@fmdevui/fm-dev

Version:

Page level components developed based on Element Plus.

57 lines (54 loc) 1.93 kB
import { defineComponent, useModel, onMounted, nextTick, resolveComponent, createBlock, openBlock, mergeModels } from 'vue'; import '../../../utils/index.mjs'; import { getBdate, getEdate, formatDate } from '../../../utils/comm/formatTime.mjs'; var _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: "Fmdatepicker" }, __name: "index", props: /* @__PURE__ */ mergeModels({ dateType: { type: String, default: "bdate" }, adddaynum: { type: Number, default: 0 } }, { "modelValue": {}, "modelModifiers": {} }), emits: ["update:modelValue"], setup(__props) { const modeValue = useModel(__props, "modelValue"); const props = __props; onMounted(() => { nextTick(() => { initdate(); }); }); const initdate = () => { if (props.dateType === "bdate" && (modeValue.value == null || modeValue.value == void 0 || modeValue.value == "")) { modeValue.value = getBdate(props.adddaynum); } else if (props.dateType === "edate" && (modeValue.value == null || modeValue.value == void 0 || modeValue.value == "")) { modeValue.value = getEdate(props.adddaynum); } else if (props.dateType === "curday" && (modeValue.value == null || modeValue.value == void 0 || modeValue.value == "")) { modeValue.value = formatDate(/* @__PURE__ */ new Date(), "YYYY-mm-dd"); } }; initdate(); return (_ctx, _cache) => { const _component_el_date_picker = resolveComponent("el-date-picker"); return openBlock(), createBlock(_component_el_date_picker, { class: "fmdatepicker", modelValue: modeValue.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modeValue.value = $event), type: "date", format: "YYYY-MM-DD", "value-format": "YYYY-MM-DD" }, null, 8, ["modelValue"]); }; } }); export { _sfc_main as default };