[update 日期单侧范围] 选单侧传参补充
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const minDate = '2000-01-01'
|
||||
const maxDate = '3000-01-01'
|
||||
export default {
|
||||
name: 'JDatePicker',
|
||||
props: {
|
||||
@@ -59,6 +61,14 @@ export default {
|
||||
if (Array.isArray(val)) {
|
||||
this.startDate = val[0] || ''
|
||||
this.endDate = val[1] || ''
|
||||
// 如果开始日期是搜索最小日期就不显示
|
||||
if (this.startDate === minDate) {
|
||||
this.startDate = ''
|
||||
}
|
||||
// 如果结束日期是搜索最小日期就不显示
|
||||
if (this.endDate === maxDate) {
|
||||
this.endDate = ''
|
||||
}
|
||||
this.dateValue = val
|
||||
} else {
|
||||
this.lastSelectDate = ''
|
||||
@@ -102,7 +112,7 @@ export default {
|
||||
},
|
||||
// 触发change事件
|
||||
triggerChange () {
|
||||
this.$emit('change', [this.startDate, this.endDate])
|
||||
this.$emit('change', [this.startDate || minDate, this.endDate || maxDate])
|
||||
},
|
||||
// 记录最后一次点击的日期
|
||||
clickCalendarDate (val) {
|
||||
|
||||
Reference in New Issue
Block a user