vue默认日期显示今天

使用时间显示默认日期
created() {
  this.getList()
  var date = new Date();
  var today = date.getDate();
  if(parseInt(today) < 10){
    today = '0' + today;
  }
  var dataMonth = date.getMonth() + 1;
  if(parseInt(dataMonth) < 10){
    dataMonth = '0' + dataMonth;
  }
  this.newdate = date.getFullYear() + '-' + dataMonth + '-' + today +' ' + '00:00:00';
  var lastDate = date.getFullYear() + '-' + dataMonth + '-' + today +' ' + '23:59:59';
  this.queryParam.startTime = this.newdate;
  this.queryParam.endTime = lastDate;
},
posted on 2020-07-23 13:53  蟑螂恶霸G  阅读(2528)  评论(0编辑  收藏  举报