zhangzengfei
2021-09-07 1cb263efda55e67a8d5066edd7709b056f9b85ff
src/views/404.vue
@@ -44,39 +44,39 @@
<script>
  export default {
    name: 'Page404',
  name: "Page404",
    data() {
      return {
        jumpTime: 5,
        oops: '抱歉!',
        headline: '当前页面不存在...',
        info: '请检查您输入的网址是否正确,或点击下面的按钮返回首页。',
        btn: '返回首页',
      oops: "抱歉!",
      headline: "当前页面不存在...",
      info: "请检查您输入的网址是否正确,或点击下面的按钮返回首页。",
      btn: "返回首页",
        timer: 0,
      }
    };
    },
    mounted() {
      this.timeChange()
    this.timeChange();
    },
    beforeDestroy() {
      clearInterval(this.timer)
    clearInterval(this.timer);
    },
    methods: {
      timeChange() {
        this.timer = setInterval(() => {
          if (this.jumpTime) {
            this.jumpTime--
          this.jumpTime--;
          } else {
            this.$router.push({ path: '/' })
            this.$store.dispatch('tabsBar/delOthersRoutes', {
              path: '/',
            })
            clearInterval(this.timer)
          this.$router.push({ path: "/" });
          this.$store.dispatch("tabsBar/delOthersRoutes", {
            path: "/",
          });
          clearInterval(this.timer);
          }
        }, 1000)
      }, 1000);
      },
    },
  }
};
</script>
<style lang="scss" scoped>