ant-design-vue Date range控制日期的选择功能
<a-range-picker :format="dateFormat" :disabled-date="disabledDate" @change="onChange" v-model="tbdate"/>
import moment from 'moment'
data(){return {dateFormat: 'YYYY-MM-DD',tbdate:undefined}}
methods: {
moment,
disabledDate (current) {
return (current < moment().subtract(90, "days")) || (current > moment().startOf('day'))
// return current && current < moment().endOf(‘day’);!!!!!当天之前的不可选,包括当天
// return current < moment().subtract(1, ‘day’) !!!!!当天之前的不可选,不包括当天
//(current > moment().subtract(0, "day")) //当天之后的日期不可选,包括当天 (已测)
},
onChange (date, dateString) {
this.tbformdata = {
start: dateString[0],
end: dateString[1]
}
}
}
来源:oschina
链接:https://my.oschina.net/u/4339497/blog/4946021