一:显示年月
js代码:
二:选择年月日
js代码:
export default {
data() {
return {
selectDay:''
}
},
created() {
this.initData({});
},
methods: {
dataSearch() {
this.getListByDay();
},
async initData(data) {
//获取当前时间
var now = new Date();
var monthn = now.getMonth()+1;
var yearn = now.getFullYear();
var dayn = now.getDate();
this.selectDay = yearn+"-"+monthn+"-"+dayn;
this.selectUser = parseInt(sessionStorage.getItem("userid"));
this.getListByDay();
},
async getListByDay(data) {
}
}
}
三:显示年月日时分(秒)
js代码:
export default {
data() {
return {
selectDatetime:''
}
},
created() {
this.initData({});
},
methods: {
dataSearch() {
this.getListByDataTime();
},
async initData(data) {
//获取当前时间
var now = new Date();
var monthn = now.getMonth()+1;
var yearn = now.getFullYear();
var dayn = now.getDate();
var h = now.getHours();
var m =now.getMinutes();
var s = now.getSeconds();
this.selectDatetime = yearn+"-"+monthn+"-"+dayn+" "+h+":"+m+":"+s;
this.selectUser = parseInt(sessionStorage.getItem("userid"));
this.getListByDataTime();
},
async getListByDataTime(data) {
}
}
}