Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-06-24 14:36:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
84c2720c7eacb0e838ba472b6a8578b45f2d239d
84c2720c
1 parent
be53e8eb
fix 滚动高度取整,不然不一样
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
src/views/client/bookDetail.vue
src/views/client/bookDetail.vue
View file @
84c2720
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-21 09:35:14
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-24 14:
29:32
* @LastEditTime: 2022-06-24 14:
35:03
* @FilePath: /tswj/src/views/client/bookDetail.vue
* @Description:
-->
...
...
@@ -164,7 +164,25 @@ onMounted(async () => {
}, 500);
// TAG: 监听滚动到底部
// 快捷访问组件高度动态调整
window.onscroll = function () {
// window.onscroll = function () {
// //变量scrollTop是滚动条滚动时,距离顶部的距离
// const scrollTop = document.documentElement.scrollTop||document.body.scrollTop;
// //变量windowHeight是可视区的高度
// const windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
// //变量scrollHeight是滚动条的总高度
// const scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;
// //滚动条到底部的条件
// if(scrollTop + windowHeight === scrollHeight){
// // console.warn("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight);
// customStyle.value.bottom = '35%'
// } else {
// customStyle.value.bottom = '8rem'
// }
// }
})
// 快捷访问组件高度动态调整
window.onscroll = function () {
//变量scrollTop是滚动条滚动时,距离顶部的距离
const scrollTop = document.documentElement.scrollTop||document.body.scrollTop;
//变量windowHeight是可视区的高度
...
...
@@ -172,14 +190,13 @@ onMounted(async () => {
//变量scrollHeight是滚动条的总高度
const scrollHeight = document.documentElement.scrollHeight||document.body.scrollHeight;
//滚动条到底部的条件
if(scrollTop + windowHeight
=== scrollHeight){
if (parseInt(scrollTop + windowHeight)
=== scrollHeight){
// console.warn("距顶部"+scrollTop+"可视区高度"+windowHeight+"滚动条总高度"+scrollHeight);
customStyle.value.bottom = '35%'
} else {
customStyle.value.bottom = '8rem'
}
}
})
}
// 判断是否显示简介的展开图标
const hasToggle = ref(false); // 判断是否有展开文字,默认没有
...
...
Please
register
or
login
to post a comment