var vm = new Vue({ el: '#date', data: { hour: "", week: "", curweek: "", day: "", curday: "", month: "", outday: "", }, created: function () { //这里是定时器 this.timer(); setInterval(this.timer, 60000); }, methods: { timer: function () { var myDate = new Date(); var myYear = myDate.getFullYear(); // 获取当前年份 var myMonth = myDate.getMonth() + 1; // 获取当前月份 var myDay = myDate.getDate(); // 获取当前日(1- 31) var myHours = myDate.getHours(); // 获取当前小时(0-23) var myMinu = myDate.getMinutes(); // 获取当前分钟(0-59) var mySec = myDate.getSeconds(); // 获取当前秒数(0-59) var myWeek = myDate.getDay() -1; //获取当前星期几(0-6) this.hour = myHours; this.year = myYear; this.month = myMonth - 1; this.day = myDay - 1; this.curday = myDay; this.week = myWeek; this.curweek = myWeek +1; this.minute = myMinu; this.age = myYear - this.yearForYour; }, //今天 jinduT: function () { var tian = ((this.hour * 60 + this.minute) / 24 / 60 * 100).toFixed(1); return "