您的位置:首页 > Web前端 > Vue.js

vue 获取当前时间 年月日 时分秒

2020-03-05 08:36 2206 查看

mounted: function() {
var _this = this;
let yy = new Date().getFullYear();
let mm = new Date().getMonth()+1;
let dd = new Date().getDate();
let hh = new Date().getHours();
let mf = new Date().getMinutes()<10 ? ‘0’+new Date().getMinutes() : new Date().getMinutes();
let ss = new Date().getSeconds()<10 ? ‘0’+new Date().getSeconds() : new Date().getSeconds();
_this.gettime = yy+’-’+mm+’-’+dd+’ ‘+hh+’:’+mf;

},
  • 点赞
  • 收藏
  • 分享
  • 文章举报
晨鼠 发布了2 篇原创文章 · 获赞 0 · 访问量 42 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: