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
tags: string[] tags: string[]
// 当前话题的 tid因为相同标签下的其它话题不包括本话题 // 当前话题的 tid因为相同标签下的其它话题不包括本话题
tid: string tid: number
} }
export interface TopicAsideMasterRequestData { export interface TopicAsideMasterRequestData {

View file

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

View file

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

View file

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

View file

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