ZZJ
2022-05-27 a689af1348938afd3b4506aad9b6d5057193e25d
src/views/index/index.vue
@@ -136,10 +136,6 @@
    this.getBanner();
    this.getRecommend();
    this.getModule();
    window.addEventListener("scroll", this.scrollListener);
  },
  destroyed() {
    window.removeEventListener("scroll", this.scrollListener);
  },
  data() {
    return {
@@ -365,7 +361,6 @@
      timer: null, //向上回滚动画
      ConnectTimer: null, // 控制弹层的定时器
      bannerList: [],
      showConnect: false, //显示联系我们与回到顶部
    };
  },
  methods: {
@@ -402,22 +397,7 @@
      this.activeCommend = id;
      this.getRecommend();
    },
    //添加滚动监听
    scrollListener() {
      //页面滑动触发事件 (滚动条移动则调用是否显示返回顶部按钮事件)
      var a = document.documentElement.clientHeight; // 滚动容器的可视高
      var b = document.documentElement.scrollTop; // 滚动条距离顶部的高度
      var c = document.documentElement.scrollHeight; // 滚动容器的整个高度
      if (c === a + b) {
        //当滚动容器的可视高+滚动容器滚动了的高度(滚动条顶部距离滚动容器顶部的距离) = 滚动容器的整个高度时,说明滚动条到底了
        this.showConnect = true;
      } else {
        this.showConnect = false;
      }
      //检查滚动条是否在顶部,控制返回顶部按钮的隐藏和显示
    },
  },
  beforeRouteLeave(to, from, next) {
    let userInfo = sessionStorage.getItem("userInfo");