hookehuyr

🐞 fix: 修复微信浏览器滚动高度适配问题

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-21 09:35:14 3 * @Date: 2022-05-21 09:35:14
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-07-01 18:07:00 5 + * @LastEditTime: 2022-07-01 20:17:04
6 * @FilePath: /tswj/src/views/client/bookDetail.vue 6 * @FilePath: /tswj/src/views/client/bookDetail.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -191,8 +191,14 @@ window.onscroll = function () { ...@@ -191,8 +191,14 @@ window.onscroll = function () {
191 const windowHeight = document.documentElement.clientHeight || document.body.clientHeight; 191 const windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
192 //变量scrollHeight是滚动条的总高度 192 //变量scrollHeight是滚动条的总高度
193 const scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight; 193 const scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;
194 + console.warn('scrollTop', scrollTop);
195 + console.warn('windowHeight', windowHeight);
196 + console.warn('scrollTop + windowHeight', scrollTop + windowHeight);
197 + console.warn('scrollHeight', scrollHeight);
194 //滚动条到底部的条件 198 //滚动条到底部的条件
195 - if (parseInt(scrollTop + windowHeight) === scrollHeight){ 199 + const height1 = scrollTop + windowHeight;
200 + const height2 = scrollTop + windowHeight - 1; // 手机上微信高度少了1px
201 + if (parseInt(height1) === scrollHeight || parseInt(height2) === scrollHeight){
196 // console.warn("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight); 202 // console.warn("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight);
197 customStyle.value.bottom = '35%' 203 customStyle.value.bottom = '35%'
198 } else { 204 } else {
......