<template> <div class="layouts"> <router-view></router-view> </div> </template> <script> // import { mapMutations, mapGetters } from "vuex"; export default { data() { return { defaultTimes: 300, }; }, computed: { // ...mapGetters(["times"]), }, created() { // this.isTimeOut(); }, methods: { // ...mapMutations(["SET_times"]), // 返回首页 // startTimer() { // clearInterval(this.timeOut); // this.SET_times(this.defaultTimes); // this.timeOut = setInterval(() => { // if (this.times == 0) { // this.$router.push({ path: "/" }); // } // this.SET_times(this.times - 1); // }, 1000); // }, // // 无任何操作返回首页 // isTimeOut() { // if (this.$route.path == "/" || this.$route.path == "/home") { // return; // } // this.startTimer(); // document.body.addEventListener("mousemove", this.startTimer); // document.body.addEventListener("mouseup", this.startTimer); // document.body.addEventListener("keyup", this.startTimer); // document.body.addEventListener("click", this.startTimer); // document.body.addEventListener("touchend", this.startTimer); // }, }, // beforeDestroy() { // document.body.removeEventListener("mousemove", this.startTimer); // document.body.removeEventListener("mouseup", this.startTimer); // document.body.removeEventListener("keyup", this.startTimer); // document.body.removeEventListener("click", this.startTimer); // document.body.removeEventListener("touchend", this.startTimer); // clearInterval(this.timeOut); // }, }; </script> <style lang="less"> .layouts { width: 100%; height: 100%; } </style>