var date = new Date();
var hour = date.getHours();
if (hour < 10) {
this.showTime = "上午";
} else if (hour < 12) {
this.showTime = "中午";
} else if (hour < 18) {
this.showTime = "下午";
} else {
this.showTime = "晚上";
}
时间判断,当前是上午还是下午
最新推荐文章于 2023-10-20 17:22:38 发布