From c6abdfaf883e35e9c930dbdbe533d36e2966eb23 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期一, 08 七月 2024 12:00:37 +0800 Subject: [PATCH] 检索页修改 --- pages/home/home.js | 46 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 36 insertions(+), 10 deletions(-) diff --git a/pages/home/home.js b/pages/home/home.js index 1522c7c..9bd1189 100644 --- a/pages/home/home.js +++ b/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() @@ -146,6 +151,7 @@ //鐐瑰嚮鐩綍 toPages(item) { let info = item.target.dataset.info + console.log(info); if (info.url) { if (info.text == "鍥句功鏈嶅姟") { wx.switchTab({ @@ -586,20 +592,40 @@ }, - - // 鐩戝惉婊氬姩鏉� - onScroll(e) { - this.setData({ - isWhite: true - }) - this.setData({ - isWhite: e.detail.scrollTop > 20 ? true : false + // 鎵竴鎵� + onIconScanTap() { + wx.scanCode({ + success(res) { + console.log(res); + if (res.errMsg == "scanCode:ok" && res.path) { + console.log(res.path, 2) + wx.redirectTo({ + url: '/' + res.path, + }) + } + } }) }, - onScrollToTop(e) { + + + // 鐩戝惉婊氬姩鏉� + onScroll(e) { + 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); + } + } + }, + isChange(data) { this.setData({ - isWhite: e.detail.scrollTop > 50 ? true : false + isWhite: data }) }, -- Gitblit v1.9.1