iview时间默认日期结束时间23:59:59

<FormItem label="时间:">
                        <DatePicker type="datetimerange" ref="DatePicker" style="width: 280px" v-model="createDate"
                            @on-change="timeChange">
                        </DatePicker>
</FormItem>
 
timeChange(time) {
                if (time.length && time[0] && time[1]) {
                    // 没有选择时间就默认23:59:59
                    if (parseTime(this.createDate[1]).slice(-8) === '00:00:00') {
                        this.createDate[1] = new Date(parseTime(time[1], '{y}-{m}-{d}') + ' 23:59:59')
                    }
                    this.formInline.createDateBegin = parseTime(this.createDate[0]);
                    this.formInline.createDateEnd = parseTime(this.createDate[1]);
                } else {
                    this.formInline.createDateBegin = '';
                    this.formInline.createDateEnd = '';
                }
                this.$refs['DatePicker'].internalValue = this.createDate;
            },
posted @ 2020-06-11 11:01  苏小白啊  阅读(2149)  评论(0编辑  收藏  举报