Vant: [Bug Report] 日历calendar组件

Created on 27 Feb 2020  ·  3Comments  ·  Source: youzan/vant

设备 / 浏览器

谷歌

Vant 版本

2.5.2

Vue 版本

3.0.0-alpha.1

描述问题

v-model="showCalendar"
type="range"
color="#288ef8"
close-on-popstate
title="以到期日期选择范围"
:default-date="new Date()"
:min-date="getMinDate()"
@confirm="confirmDate"
/>
getMinDate() {
var currentTime = new Date(); //当前日期
var currenDay = currentTime.getDate(); //当前日
var currenMonth = currentTime.getMonth(); //当前月
var currenYear = currentTime.getFullYear(); //当前年
return new Date(currenYear - 2, currenMonth, 1);
},
默认选中的不是今天,我给了最小时间和默认选中,不给默认选中也不行。

Most helpful comment

range模式下默认选中是个数组
defaultDate:Date[] = [new Date(Date.now()-1000*3600*24),new Date()]

All 3 comments

想要的效果是:打开默认选中今天,前后日期各一年半年 都行。

range模式下默认选中是个数组
defaultDate:Date[] = [new Date(Date.now()-1000*3600*24),new Date()]

范围模式下上下划线是个片断
defaultDate:Date[] = [new Date(Date.now()-1000*3600*24),new Date()]

谢谢:我试试

Was this page helpful?
0 / 5 - 0 ratings