From 9ebc7272c0ecb22b0654f7280cf0d4768119360b Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Mon, 29 Jan 2024 15:22:28 +0800 Subject: [PATCH] 优化顶部样式 --- pages/index/index/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 1c5ed6f..ec17090 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -92,6 +92,7 @@ Page({ is_full_screen_navigation_index: -1, //广告轮播满屏下标 nav_title: '首页', nav_frontColor: "#000", + old_nav_frontColor: "", nav_backgroundColor: "#fff", nav_type: 1, //导航类型 searchbox_transparent: 1, //搜索框背景是否透明 @@ -739,7 +740,7 @@ Page({ backgroundColor: temp_data.top_color, // 必写项 }) th.setData({ - // nav_frontColor: top_w_color, // 必写项 + nav_frontColor: top_w_color, // 必写项 nav_backgroundColor: temp_data.top_color, // 必写项 }) } @@ -1011,6 +1012,11 @@ Page({ onPageScroll: function (e) { //满屏模式监听 let num = e.scrollTop + if (!this.data.old_nav_frontColor) { + this.setData({ + old_nav_frontColor:this.data.nav_frontColor + }) + } if (this.data.is_full_screen_navigation) { let nav_type = this.data.nav_type if (num >= 100 && nav_type) { @@ -1025,7 +1031,7 @@ Page({ this.setData({ nav_type: 1, searchbox_transparent: 1, - nav_frontColor: '#000' + nav_frontColor: this.data.old_nav_frontColor }) // this.data.nav_type = 1 } -- libgit2 0.21.4