Browse Source

查询路由

lite
luyisha 3 years ago
parent
commit
a4ce7b3c2a
  1. 36
      src/App.vue

36
src/App.vue

@ -59,14 +59,22 @@ export default {
const seconds = ('0' + this.date.getSeconds()).slice(-2); const seconds = ('0' + this.date.getSeconds()).slice(-2);
this.curtime = `${hours}:${minutes}:${seconds}` this.curtime = `${hours}:${minutes}:${seconds}`
this.nowtime = `${year}.${month}.${day} ` + cweeks[wday]; this.nowtime = `${year}.${month}.${day} ` + cweeks[wday];
setTimeout(()=>{
// console.log(this.$router.currentRoute.path)
let path = this.$router.currentRoute.path;
if(path=='/'){
this.currentPage = 0;
}else if(path=='/ty'){
this.currentPage = 2;
}else if(path=='/cultrue'){
this.currentPage = 1;
}
}, 500)
}, },
mounted() { mounted() {
this.getTimespan(); this.getTimespan();
this.getStat(); this.getStat();
// this.getWS() // this.getWS()
// setInterval(() => {
// this.autoChange();
// }, 10000);
}, },
watch: { watch: {
timeCount: { timeCount: {
@ -100,15 +108,15 @@ export default {
let that = this let that = this
homeApi.allGroupNum().then(res => { homeApi.allGroupNum().then(res => {
// get allTimeData // get allTimeData
const tmpdata = res.data.returnData if(res.data){
this.day_num = tmpdata.day.noRepeatInNum const tmpdata = res.data.returnData
this.week_num_num = tmpdata.week.noRepeatInNum this.day_num = tmpdata.day.noRepeatInNum
this.mon_num = tmpdata.month.noRepeatInNum this.week_num_num = tmpdata.week.noRepeatInNum
this.year_num = tmpdata.year.noRepeatInNum this.mon_num = tmpdata.month.noRepeatInNum
this.year_num = tmpdata.year.noRepeatInNum
this.sumYear_num = tmpdata.sumYear.noRepeatInNum
this.sumYear_num = tmpdata.sumYear.noRepeatInNum
}
}); });
}, },
getWS(){ getWS(){
@ -135,13 +143,13 @@ export default {
autoChange(){ autoChange(){
if(this.currentPage==0){ if(this.currentPage==0){
this.currentPage = 1; this.currentPage = 1;
this.$router.push({ path: '/'}) this.$router.push({ path: '/cultrue'})
}else if(this.currentPage==1){ }else if(this.currentPage==1){
this.currentPage = 2; this.currentPage = 2;
this.$router.push({ path: '/cultrue'}) this.$router.push({ path: '/ty'})
}else{ }else{
this.currentPage = 0; this.currentPage = 0;
this.$router.push({ path: '/ty'}) this.$router.push({ path: '/'})
} }
}, },
mouseMove() { mouseMove() {

Loading…
Cancel
Save