|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
- <div :style="{ width: item.width ? item.width + 'px' : '100%' }">
|
|
|
+ <div :style="{ width: item?.width ? item?.width + 'px' : '100%' }">
|
|
|
<div class="d-flex align-center">
|
|
|
- <div class="form-label" :style="{'width': item.labelWidth + 'px'}">{{ item.label }}</div>
|
|
|
+ <div v-if="item?.label" class="form-label" :style="{'width': item.labelWidth + 'px'}">{{ item.label }}</div>
|
|
|
<el-config-provider :locale="zhCn">
|
|
|
<el-date-picker
|
|
|
style="flex: 1;"
|
|
@@ -51,8 +51,14 @@ watch(() => props.modelValue,
|
|
|
|
|
|
// 过去的日期不可选
|
|
|
const disabledDates = (date) => {
|
|
|
+ // 未来的日期不可选
|
|
|
+ if (props.item?.disabledFutureDates) {
|
|
|
+ return date.getTime() > Date.now()
|
|
|
+ }
|
|
|
+
|
|
|
const currentDate = new Date()
|
|
|
if (!props.item.disabledDate) return false
|
|
|
+ // 过去的日期不可选
|
|
|
currentDate.setDate(currentDate.getDate() - 1)
|
|
|
return date.getTime() < currentDate.getTime()
|
|
|
}
|