currentTime: Math.round(new Date().getTime()/1000), 当前时间
clocker: “”, //显示倒计时
timeobj: null, //时间对象
text:‘自习时间还剩:’,
go_study:false,
};
},
created(){
var calss1_start2 = Math.round(new Date(new Date(new Date().getTime()).setHours(8,0,0,0))/1000) //获取当天8点 开始自习
var calss1_start = Math.round(new Date(new Date(new Date().getTime()).setHours(0,8,0,0))/1000)
var calss1_end = Math.round(new Date(new Date(new Date().getTime()).setHours(0,8,10,0))/1000)
var rest_start = Math.round(new Date(new Date(new Date().getTime()).setHours(0,8,0,0))/1000)
var rest_end = Math.round(new Date(new Date(new Date().getTime()).setHours(0,8,10,0))/1000)
this.endTime = calss1_end;
this.startTime = calss1_start;
console.log(this.endTime,this.startTime)
if(this.currentTime >= calss1_start2){
console.log(this.currentTime)
this.go_study = true;
}
this.begin();
// var timestamp = Math.round(new Date(‘2019-11-29 16:00:00’).getTime()/1000); //获取指定时间的时间戳/1000 是要舍弃后面三位数
// var timestamp2 = Math.round(new Date().getTime()/1000); //获取当前的时间戳
// var timestamp3 = Math.round(new Date(new Date().toLocaleDateString()).getTime()/1000) //当天零点
// let startTime = Math.round(new Date(new Date(new Date().getTime()-246060*1000).setHours(0,0,0,0))/1000);// 前一天0点
// let endTime = Math.round(new Date(new Date(new Date().getTime()-246060*1000).setHours(23,59,59,999))/1000) //当天零点
},
methods: {
begin(){
let timeLag = parseInt(this.endTime) - parseInt(this.startTime);
let add0 = num => {
return num < 10 ? “0” + num : num;
};
let timeFunction = () => {
// time为两个时间戳之间相差的秒数
let time = timeLag–;
//打印出时间对象
this.timeobj = {
seconds: time % 60,
minutes: Math.floor(time / 60) % 60,
hours: Math.floor(time / 60 / 60) % 24,
days: Math.floor(time / 60 / 60 / 24),
weeks: Math.floor(time / 60 / 60 / 24 / 7),
months: Math.floor(time / 60 / 60 / 24 / 30),
years: Math.floor(time / 60 / 60 / 24 / 365)
};
this.clocker =
`
${add0(this.timeobj.hours)}:
${add0(this.timeobj.minutes)}:
${add0(this.timeobj.seconds)}
`;
// 当时间差小于等于0的时候证明倒计时已经过结束
if (time <= 0) {
clearInterval(go);
this.go_study = !this.go_study;
this.go_rest = true;
this.begin2();
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:前端)
![](https://img-blog.csdnimg.cn/img_convert/15793ef748062eea716aa530d3065757.jpeg)
最后
javascript是前端必要掌握的真正算得上是编程语言的语言,学会灵活运用javascript,将对以后学习工作有非常大的帮助。掌握它最重要的首先是学习好基础知识,而后通过不断的实战来提升我们的编程技巧和逻辑思维。这一块学习是持续的,直到我们真正掌握它并且能够灵活运用它。如果最开始学习一两遍之后,发现暂时没有提升的空间,我们可以暂时放一放。继续下面的学习,javascript贯穿我们前端工作中,在之后的学习实现里也会遇到和锻炼到。真正学习起来并不难理解,关键是灵活运用。
并不难理解,关键是灵活运用。
[外链图片转存中…(img-8UsBiu2t-1712215541834)]
[外链图片转存中…(img-UmrGyEU6-1712215541834)]