其他分享
首页 > 其他分享> > DateTimePicker 日期时间选择器设置默认时间

DateTimePicker 日期时间选择器设置默认时间

作者:互联网

想要效果:

 

vue中设置方法:

mounted() {
  this.defaultDate();
},
methods: {
    defaultDate() {
      this.emailQueryStrS = '';
      this.emailQueryStrE = '';
      const myDate = new Date();
      const time = '00:00:00';
      const year = myDate.getFullYear();
      const month = myDate.getMonth() + 1;
      const date = myDate.getDate();
      const now =
        year +
        '-' +
        (month < 10 ? '0' : '') +
        month +
        '-' +
        (date < 10 ? '0' : '') +
        date +
        ' ' +
        time;
      this.emailQueryStrS = now;
      this.emailQueryStrE = now;
    }
}

标签:00,now,const,myDate,默认,month,date,DateTimePicker,选择器
来源: https://blog.csdn.net/m0_59930878/article/details/122625922