Giter Club home page Giter Club logo

Comments (7)

ATQQ avatar ATQQ commented on July 18, 2024 2

修复代码见

https://github.com/ATQQ/sugar-blog/pull/140/files#diff-624ff9b1e80bac80e7f7235ab1169dde84f9965a542b1891c49ad350e622f7a4

from sugar-blog.

ATQQ avatar ATQQ commented on July 18, 2024

Get 之前也发现了 没注意😂 我也以为vitepress bug嘞 我明后天看看 可能是我hack了什么东西导致的

from sugar-blog.

rennzhang avatar rennzhang commented on July 18, 2024

👍
大佬知道大概在哪里解决的话我可以帮忙解决一下

from sugar-blog.

ATQQ avatar ATQQ commented on July 18, 2024

👍 大佬知道大概在哪里解决的话我可以帮忙解决一下

没问题,我周末看一下,周中确实太忙了,顾不上

from sugar-blog.

ATQQ avatar ATQQ commented on July 18, 2024

看了一下 VitePress 源码 大概是下面这段代码 @rennzhang

https://github.com/vuejs/vitepress/blob/0d56855b54a97d4350485ee76c07a040fdc5738c/src/client/theme-default/composables/outline.ts#L145-L151

const scrollY = window.scrollY;
const innerHeight = window.innerHeight;
const offsetHeight = document.body.offsetHeight;
const isBottom = Math.abs(scrollY + innerHeight - offsetHeight) < 1

    // page bottom - highlight last one
    if (anchors.length && isBottom) {
      activateLink(anchors[anchors.length - 1].hash)
      return
    }

在我这个主题上 isBottom 判断出现了问题,具体是哪块影响的我再进一步看一下

from sugar-blog.

ATQQ avatar ATQQ commented on July 18, 2024

这个是 vitepress 正常初识的值(我这个设备)

scrollY 0
innerHeight 1067
offsetHeight 3129
abs 2062

主题上异常的值

scrollY 0
innerHeight 1067
offsetHeight 1067
abs 0

大概就是window.innerHeightdocument.body.offsetHeight 一样了导致的这个问题(在我这个主题上),应该是我这边的样式影响了 body 的 offsetHeight 高度

from sugar-blog.

ATQQ avatar ATQQ commented on July 18, 2024

这个bug在主题里是 vitepress-plugin-pagefind 这个插件引入的 我先迭代一下我这边

你可以尝试在 vitepress 侧优化一下那个 isBottom 的判断,兼容这个case

html,
body{
  height: 100%;
}

from sugar-blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.