fix: magic bug with magic wait

This commit is contained in:
Tim
2025-08-05 19:54:43 +08:00
parent eb933b8f78
commit 009d139549

View File

@@ -566,7 +566,8 @@ export default {
const hash = location.hash
if (hash.startsWith('#comment-')) {
const id = hash.substring('#comment-'.length)
await nextTick()
// 不清楚啥原因先wait一下子不然会定不准 😅
await new Promise(resolve => setTimeout(resolve, 500))
const el = document.getElementById('comment-' + id)
if (el) {
const top = el.getBoundingClientRect().top + window.scrollY - headerHeight - 20 // 20 for beauty