fix: 已经加载的帖子 重新进入 没有执行评论定位逻辑 #652

This commit is contained in:
Tim
2025-08-20 19:43:31 +08:00
parent 4969a759aa
commit 91ffacc335

View File

@@ -876,12 +876,7 @@ const gotoProfile = () => {
navigateTo(`/users/${author.value.id}`, { replace: true })
}
onActivated(async () => {
await refreshPost()
await fetchComments()
})
onMounted(async () => {
const initPage = async () => {
await fetchComments()
const hash = location.hash
const id = hash.startsWith('#comment-') ? hash.substring('#comment-'.length) : null
@@ -889,6 +884,14 @@ onMounted(async () => {
updateCurrentIndex()
window.addEventListener('scroll', updateCurrentIndex)
jumpToHashComment()
}
onActivated(async () => {
await initPage()
})
onMounted(async () => {
await initPage()
})
</script>