想要效果:
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;
}
}