首页 > 其他 > 详细

Vue实现点击时间获取时间段查询功能

时间:2019-08-29 13:17:02      阅读:463      评论:0      收藏:0      [点我收藏+]

二话不说,先上图技术分享图片

实现如上代码:

           //获取本周第一天
            showWeekFirstDay: function () {
                let Nowdate = new Date();
                let WeekFirstDay = new Date(Nowdate - (Nowdate.getDay() - 1) * 86400000);
                let M = Number(WeekFirstDay.getMonth()) + 1;
                if (M < 10) {
                    M = "0" + M;
                }
                let D = WeekFirstDay.getDate();
                if (D < 10) {
                    D = "0" + D;
                }
                return WeekFirstDay.getFullYear() + "-" + M + "-" + D;
            },
            // 自动回填日期
            autoTime(type) {
                this.active_time_type = type;
                switch (type) {
                    case 1:
              //今日
var temp_start_create_time = new Date().Format("yyyy-MM-dd"); var temp_end_create_time = new Date().Format("yyyy-MM-dd"); break; case 2:
              //本周
var temp_start_create_time = this.showWeekFirstDay() var temp_end_create_time = new Date().Format("yyyy-MM-dd"); break; case 3:
              //本月
var temp_start_create_time = util.getCurrentMonthFirst(); var temp_end_create_time = util.getCurrentMonthLast(); break; default: break; } this.value1 = []//element-ui 使用的日期控件定义的v-model值 this.value1.push(temp_start_create_time, temp_end_create_time) this.start_create_time = this.value1[0]; this.end_create_time = this.value1[1]; } }

 

Vue实现点击时间获取时间段查询功能

原文:https://www.cnblogs.com/Ashley77/p/11428895.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!