This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修正由于未知原因,导致父容器产生滚动距离导致的内容被遮挡的bug

old
宇天 2021-05-26 11:58:27 +08:00
parent ae226098c9
commit 36feda623d
1 changed files with 10 additions and 6 deletions

View File

@ -240,12 +240,16 @@ export default class Scroll {
// 初始化滚动条的位置和长度
this._initFn = ev => {
// 需要减去因为隐藏原生滚动条修正的18像素
var width = this.offsetWidth
var height = this.offsetHeight
var scrollWidth = this.__BOX__.scrollWidth - 18
var scrollHeight = this.__BOX__.scrollHeight - 18
var yBar = (height * (height / scrollHeight)) >> 0 // 滚动条的高度
var xBar = (width * (width / scrollWidth)) >> 0 // 滚动条的宽度
let width = this.offsetWidth
let height = this.offsetHeight
let scrollWidth = this.__BOX__.scrollWidth - 18
let scrollHeight = this.__BOX__.scrollHeight - 18
let yBar = (height * (height / scrollHeight)) >> 0 // 滚动条的高度
let xBar = (width * (width / scrollWidth)) >> 0 // 滚动条的宽度
// 修正由于未知原因,导致父容器产生滚动距离
// 导致的内容被遮挡的bug
this.__BOX__.parentNode.scrollTop = 0
// 修复因为内容的margin导致滚动条取值不准确的bug
if (this.__BOX__.clientHeight - height !== 18) {