本文主要是介绍iview-时间选择器,不可设置时间,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<FormItem label="销售时间" :label-width="80"><DatePicker type="date" :options="startTime" @on-change="changeStartTime" v-model="formInline.startDate" style="width: 110px;"></DatePicker> - <DatePicker type="date" :options="endTime" @on-change="changeEndTime" v-model="formInline.endDate" style="width: 110px;"></DatePicker></FormItem>
export default {data (){return {formInline : {startDate : '',endDate : ''},startTime : {},endTime : {},}}
}
changeStartTime(val){this.formInline.startDate = val;this.endTime = {disabledDate: date => {let startTime = this.formInline.startDate ? new Date(this.formInline.startDate).valueOf() - 1 * 24 * 60 * 60 * 1000 : '';return date && (date.valueOf() < startTime);}}},changeEndTime(val){this.formInline.endDate = val;let endTime = this.formInline.endDate ? new Date(this.formInline.endDate).valueOf() : '';this.startTime = {disabledDate(date) {return date && date.valueOf() > endTime;}}},
转载自:(http://www.cnblogs.com/donaf/p/9753015.html)
这篇关于iview-时间选择器,不可设置时间的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!