diff --git a/src/App.vue b/src/App.vue
index 07c2061..e5fe1c1 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -7,7 +7,7 @@
累计进馆人数:3,435,123万人
-
星期四 16:33:33
+ {{nowtime}} {{ curtime }}
体育
@@ -27,18 +27,46 @@
export default {
data() {
return {
- //
-
+ // 当前时间
+ date:new Date(),
+ nowtime:"",
+ curtime:'',
};
},
created() {
- // console.log(this.$route)
+ const cweeks =['星期一','星期二','星期三','星期四','星期五','星期六','星期日',]
+ // 取当前时间
+ const year = this.date.getFullYear();
+ const month = ('0' + (this.date.getMonth() + 1)).slice(-2);
+ const day = ('0' + this.date.getDate()).slice(-2);
+ // 周几
+ const wday = this.date.getDay()-1;
+ // 创建时候附带时间
+ const hours = ('0' + this.date.getHours()).slice(-2);
+ const minutes = ('0' + this.date.getMinutes()).slice(-2);
+ const seconds = ('0' + this.date.getSeconds()).slice(-2);
+ this.curtime = `${hours}:${minutes}:${seconds}`
+ this.nowtime = `${year}.${month}.${day} `+ cweeks[wday];
+ console.log(this.nowtime)
},
mounted() {
-//
+ this.getTimespan();
},
methods: {
//
+ getTimespan(){
+ // 时分秒
+
+ setInterval(()=>{
+ let tdate = new Date();
+ //this.curtime = new Date().get.toLocaleString()
+ const hours = ('0' + tdate.getHours()).slice(-2);
+ const minutes = ('0' + tdate.getMinutes()).slice(-2);
+ const seconds = ('0' + tdate.getSeconds()).slice(-2);
+ // console.log(seconds)
+ this.curtime = `${hours}:${minutes}:${seconds}`
+ },1000)
+ }
},
};
@@ -58,7 +86,7 @@ body {
// 基类
.btgym {
width: 100vw;
- height: 100%;
+ // height: 100%;
position: relative;
background-size: 100%;
background-repeat: no-repeat;