Merge pull request #639 from CH-122/fix/post-page-update

修复文章详情页面返回后不更新数据 & 优化 /reaction-types 接口重复调用
This commit is contained in:
Tim
2025-08-19 17:02:30 +08:00
committed by GitHub
3 changed files with 66 additions and 25 deletions

View File

@@ -166,7 +166,7 @@
</template>
<script setup>
import { ref, computed, onMounted, onBeforeUnmount, nextTick, watch, watchEffect } from 'vue'
import { ref, computed, onMounted, onBeforeUnmount, nextTick, watch, watchEffect, onActivated } from 'vue'
import VueEasyLightbox from 'vue-easy-lightbox'
import { useRoute } from 'vue-router'
import CommentItem from '~/components/CommentItem.vue'
@@ -753,6 +753,11 @@ const gotoProfile = () => {
navigateTo(`/users/${author.value.id}`, { replace: true })
}
onActivated(async () => {
await refreshPost()
await fetchComments()
})
onMounted(async () => {
await fetchComments()
const hash = location.hash