vue 选择当天之后的日期
作者:互联网
样式:
<a-form-item label="日期" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-date-picker v-nodel="nextTime" :disabled-date="disabledStartDate" format="YYYY-MM-DD " placeholder="请选择日期" @openChange="handleStartOpenChange" /> </a-form-item>
data声明
startValue: null, endValue: null, endOpen: false,
方法:
disabledStartDate(startValue) { return startValue.valueOf() < new Date() }, disabledEndDate(endValue) { const startValue = this.form.getFieldValue('nextTime') if (!endValue || !startValue) { return false } return startValue.valueOf() >= endValue.valueOf() || endValue.valueOf() > new Date() }, handleStartOpenChange(open) { if (!open) { this.endOpen = true } }, handleEndOpenChange(open) { this.endOpen = open },
效果:
标签:vue,return,valueOf,当天,日期,endOpen,endValue,open,startValue 来源: https://www.cnblogs.com/sunqiaozhen/p/16418831.html