提交 e108473c 编写于 作者: D DCloud_LXH

feat: 改进 md-virtual 逻辑

上级 9bfa1992
...@@ -20,10 +20,12 @@ ...@@ -20,10 +20,12 @@
[...contentChildren].forEach((child, index) => { [...contentChildren].forEach((child, index) => {
if (child.nodeName === 'UL') { if (child.nodeName === 'UL') {
const ulHeight = child.clientHeight; const ulHeight = child.clientHeight;
const isVisible = visibleHeight + window.scrollY > child.offsetTop - 500; const ulOffsetTop = child.offsetTop;
const isVisible = visibleHeight + window.scrollY > ulOffsetTop - 500;
const isOver = window.scrollY > ulOffsetTop + ulHeight
child.style.height = `${ulHeight}px`; child.style.height = `${ulHeight}px`;
if (!isVisible) { if (!isVisible || isOver) {
const _ul = document.createDocumentFragment(); const _ul = document.createDocumentFragment();
[...child.children].forEach(item => _ul.appendChild(item)); [...child.children].forEach(item => _ul.appendChild(item));
(!this.contentFrame[index] || !this.contentFrame[index].children.length) && (!this.contentFrame[index] || !this.contentFrame[index].children.length) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册