<template>
<div id="home">
当前时间为:{{gettime}}
</div>
</template>
<script>
export default {
name: "Home",
data() {
return {
gettime:'',
},
methods: {
getTime:function(){
var that= this;
let yy = new Date().getFullYear();
var mm =new Date().getMonth() < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1;
var dd = new Date().getDate() <10 ? "0" + new Date().getDate() : 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();
that.gettime = yy+'-'+mm+'-'+dd+' '+hh+':'+mf+':'+ss;
}
}
}
</script>
<style scoped>
</style>
因篇幅问题不能全部显示,请点此查看更多更全内容