BUG fix: router
This commit is contained in:
parent
ead8e42bf5
commit
4ec4eb3222
|
@ -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 {
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue