From e2204ec6460fae904ea866ca9a2c3c1f9ca6234e Mon Sep 17 00:00:00 2001 From: sws <1141121512@qq.com> Date: Fri, 11 Oct 2024 14:59:08 +0800 Subject: [PATCH] =?UTF-8?q?1.head=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/header.vue | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/components/diy/header.vue b/components/diy/header.vue index 916fed18..4e00d6b1 100644 --- a/components/diy/header.vue +++ b/components/diy/header.vue @@ -138,19 +138,16 @@ }, watch: { propScrollTop(newVal) { - if (newVal < this.header_top) { - console.log(this.propValue); - const { up_slide_background_color_list, up_slide_background_direction, up_slide_background_img, up_slide_background_img_style } = this.propValue.style || {}; - // 渐变 - const gradient = { color_list: up_slide_background_color_list, direction: up_slide_background_direction }; - // 背景图 - const back = { background_img: up_slide_background_img, background_img_style: up_slide_background_img_style }; - this.setData({ - // 20是大小误差 - up_slide_style: gradient_computer(gradient) + 'opacity:' + (newVal / (this.header_top + 33) > 1 ? 1 : (newVal / (this.header_top + 33)).toFixed(2)) + ';', - up_slide_img_style: background_computer(back), - }); - } + const { up_slide_background_color_list, up_slide_background_direction, up_slide_background_img, up_slide_background_img_style } = this.propValue.style || {}; + // 渐变 + const gradient = { color_list: up_slide_background_color_list, direction: up_slide_background_direction }; + // 背景图 + const back = { background_img: up_slide_background_img, background_img_style: up_slide_background_img_style }; + this.setData({ + // 20是大小误差 + up_slide_style: gradient_computer(gradient) + 'opacity:' + ((newVal - 20) / (this.header_top + 33) > 1 ? 1 : ((newVal - 20) / (this.header_top + 33)).toFixed(2)) + ';', + up_slide_img_style: background_computer(back), + }); }, propkey(val) { if ((this.propValue || null) !== null) {