闫增涛
2024-04-29 558845242a07b68f42fa1802c45ab2769395d8b8
pages/home/home.js
@@ -11,6 +11,7 @@
    barHeight: '',
    navBarHeight: '',
    searchVal: '',
    scoll: false,
    isWhite: false,
    userInfo: {},
    tabList: [], //目录
@@ -40,6 +41,10 @@
    loading: true
  },
  onShow() {
    this.setData({
      searchVal: "",
    });
    console.log(this.data.searchVal)
    this.loadHomePage();
    this.getBannerList()
@@ -589,17 +594,21 @@
  // 监听滚动条
  onScroll(e) {
    this.setData({
      isWhite: true
    })
    this.setData({
      isWhite: e.detail.scrollTop > 20 ? true : false
    })
    if (this.data.scoll) {
      if (e.detail.scrollTop < 20) {
        this.data.scoll = false
        this.isChange(false);
      }
    } else {
      if (e.detail.scrollTop > 20) {
        this.data.scoll = true
        this.isChange(true);
      }
    }
  },
  onScrollToTop(e) {
  isChange(data) {
    this.setData({
      isWhite: e.detail.scrollTop > 50 ? true : false
      isWhite: data
    })
  },