
vue项目如何定义时间,下面web建站小编给大家介绍一下实现代码!
获取时间代码如下:
timeFormate(v) {
let year = new Date(v).getFullYear();
let month =new Date(v).getMonth() + 1 < 10? "0" + (new Date(v).getMonth() + 1): new Date(v).getMonth() + 1;
let date =new Date(v).getDate() < 10? "0" + new Date(v).getDate(): new Date(v).getDate();
let hh =new Date(v).getHours() < 10? "0" + new Date(v).getHours(): new Date(v).getHours();
let mm =new Date(v).getMinutes() < 10? "0" + new Date(v).getMinutes(): new Date(v).getMinutes();
let ss =new Date(v).getSeconds() < 10? "0" + new Date(v).getSeconds(): new Date(v).getSeconds();
this.nowTime = year + "年" + month + "月" + date +"日"+" "+hh+":"+mm+':'+ss ;
},
nowTimes(){
this.timeFormate(new Date());
setInterval(this.nowTimes,1000);
this.clear()
},
clear(){
clearInterval(this.nowTimes)
this.nowTimes = null;
}
上面是“vue项目如何定义时间(代码介绍)”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_2912.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

Nginx如何配置gzip压缩最小文件大小
战网网页版官网首页入口,手把手教您轻松创建战网账户
分析小红书优质笔记的写法
小红书官方网站在线网页版首页入口