html
<FormItem label="活动时间" prop="activity_time"> <DatePicker v-model="addForm.activity_time" @on-change="param.activity_time=$event" type="date" format="yyyy-MM-dd" :options="options" placeholder="活动时间" style="width: 214px" :disabled="modalDisable" ></DatePicker> </FormItem>
js
options: { disabledDate(date) { let dateTime = new Date(); let currentYear = dateTime.getFullYear(); let currentMonth = dateTime.getMonth(); let monthFirstDay = new Date(currentYear, currentMonth, 1); let newMonth = ++currentMonth; let newYear = currentYear; if (newMonth >= 12) { newMonth -= 12; newYear++; } let nextMonthFirst = new Date(newYear, newMonth, 1); let nonthLastDay = new Date( nextMonthFirst.getTime() - 24 * 60 * 60 * 1000 ); return ( date.valueOf() < new Date(monthFirstDay).getTime() || date.valueOf() > new Date(nonthLastDay).getTime() ); } } //时间范围限制
原文地址:https://www.cnblogs.com/mxyr/p/11781323.html
时间: 2024-10-01 00:31:25