diff --git a/package/component/src/component/datePicker/index.vue b/package/component/src/component/datePicker/index.vue index 28921f72..cc9103a7 100644 --- a/package/component/src/component/datePicker/index.vue +++ b/package/component/src/component/datePicker/index.vue @@ -2,13 +2,13 @@
+ prefix-icon="layui-icon-date" :disabled="disabled" v-if="!range" @change="onChange" :allow-clear="!disabled&&allowClear" @clear="dateValue='';onChange()">
{{ rangeSeparator }} - +
@@ -271,6 +271,12 @@ watch( currentYear.value = initModelValue?getYear(initModelValue):-1; currentMonth.value = initModelValue?getMonth(initModelValue):-1; currentDay.value = initModelValue?getDay(initModelValue):-1; + if (props.type === 'date' || props.type === 'datetime') { // date与datetime容错 + if (currentYear.value === -1) + currentYear.value = dayjs().year(); + if (currentMonth.value === -1) + currentMonth.value = dayjs().month(); + } rangeValue.first = initModelValue; rangeValue.last = props.range && props.modelValue