BUG fix: router

This commit is contained in:
KUN1007 2023-09-14 00:25:04 +08:00
parent ead8e42bf5
commit 4ec4eb3222
5 changed files with 11 additions and 12 deletions

View file

@ -9,7 +9,7 @@ export interface TopicAsideOtherTagRequestData {
// 本话题的 tags
tags: string[]
// 当前话题的 tid因为相同标签下的其它话题不包括本话题
tid: string
tid: number
}
export interface TopicAsideMasterRequestData {

View file

@ -19,7 +19,8 @@ import KUNGalgameTopBar from '@/components/top-bar/KUNGalgameTopBar.vue'
<!-- <Transition
:enter-active-class="`animate__animated ${route.meta.transition}`"
> -->
<component :is="Component"></component>
<!-- 这里必须要加 key不然同一界面 vue router 会识别不出来页面的更新导致页面不刷新 -->
<component :is="Component" :key="route.fullPath"></component>
<!-- </Transition> -->
</RouterView>
</div>

View file

@ -3,7 +3,7 @@ import { Icon } from '@iconify/vue'
import KUNGalgameSearchBox from '@/components/KUNGalgameSearchBox.vue'
import SortTopic from './SortTopic.vue'
const category = `["Galgame"]`
const category = ['Galgame']
</script>
<template>

View file

@ -24,8 +24,6 @@ const { uid } = storeToRefs(useKUNGalgameUserStore())
const topicData = ref<TopicAside[]>()
onMounted(async () => {
console.log(tid)
topicData.value = (
await useKUNGalgameTopicStore().getPopularTopicsByUserUid({
uid: uid.value,

View file

@ -2,31 +2,31 @@
这里是楼主的其他话题组件
-->
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ref, onMounted, toRaw } from 'vue'
import { TopicAside } from '@/api/index'
// topic store
import { useKUNGalgameTopicStore } from '@/store/modules/topic'
import { RouterLink, useRoute } from 'vue-router'
import { useRoute } from 'vue-router'
const route = useRoute()
const tid = route.params.tid as string
const tid = parseInt(route.params.tid as string)
const props = defineProps<{
tags: string[]
}>()
const tags = toRaw(props.tags)
const topicData = ref<TopicAside[]>()
onMounted(async () => {
console.log(tid)
topicData.value = (
await useKUNGalgameTopicStore().getRelatedTopicsByTags({
tags: props.tags,
tags: tags,
tid: tid,
})
).data