feat: empty topic
This commit is contained in:
parent
540c4fcbd7
commit
7dee4ff190
|
@ -97,7 +97,9 @@ export default {
|
||||||
commentSort: 'Reply Sort',
|
commentSort: 'Reply Sort',
|
||||||
updatedSort: 'Update Sort',
|
updatedSort: 'Update Sort',
|
||||||
tags: 'Topics Under the Same Tags',
|
tags: 'Topics Under the Same Tags',
|
||||||
|
tagsEmpty: 'The tags currently has no other topics',
|
||||||
master: 'Other Topics of The Master',
|
master: 'Other Topics of The Master',
|
||||||
|
masterEmpty: 'Master currently has no other topics',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
status: 'Topic status',
|
status: 'Topic status',
|
||||||
|
|
|
@ -97,7 +97,9 @@ export default {
|
||||||
commentSort: '按评论排序',
|
commentSort: '按评论排序',
|
||||||
updatedSort: '按更新排序',
|
updatedSort: '按更新排序',
|
||||||
tags: '相同标签下的其它话题',
|
tags: '相同标签下的其它话题',
|
||||||
|
tagsEmpty: '该标签下暂无其它话题',
|
||||||
master: '楼主的其它话题',
|
master: '楼主的其它话题',
|
||||||
|
masterEmpty: '楼主暂无其它话题',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
status: '话题状态',
|
status: '话题状态',
|
||||||
|
|
|
@ -13,8 +13,8 @@ import { useKUNGalgameTopicStore } from '@/store/modules/topic'
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const tid = route.params.tid as string
|
const tid = route.params.tid as string
|
||||||
|
|
||||||
const topicData = ref<TopicAside[]>()
|
const topicData = ref<TopicAside[]>()
|
||||||
|
const isEmpty = ref(false)
|
||||||
|
|
||||||
const fetchTopicData = async () => {
|
const fetchTopicData = async () => {
|
||||||
return (
|
return (
|
||||||
|
@ -26,6 +26,7 @@ const fetchTopicData = async () => {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
topicData.value = await fetchTopicData()
|
topicData.value = await fetchTopicData()
|
||||||
|
isEmpty.value = !topicData.value.length
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -37,14 +38,13 @@ onMounted(async () => {
|
||||||
|
|
||||||
<TopicAsideSkeleton v-if="!topicData" />
|
<TopicAsideSkeleton v-if="!topicData" />
|
||||||
|
|
||||||
<div
|
<div class="topic" v-for="(kun, index) in topicData" :key="index">
|
||||||
class="topic"
|
|
||||||
v-else-if="topicData"
|
|
||||||
v-for="(kun, index) in topicData"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<RouterLink :to="`/topic/${kun.tid}`">{{ kun.title }}</RouterLink>
|
<RouterLink :to="`/topic/${kun.tid}`">{{ kun.title }}</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<span class="empty" v-if="isEmpty">
|
||||||
|
{{ $tm('topic.aside.masterEmpty') }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -102,4 +102,15 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 17px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: oblique;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -8,14 +8,13 @@ import { useKUNGalgameTopicStore } from '@/store/modules/topic'
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
tags: string[]
|
tags: string[]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const tags = toRaw(props.tags)
|
const tags = toRaw(props.tags)
|
||||||
|
|
||||||
// Current route instance
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
// ID of the current topic
|
|
||||||
const tid = parseInt(route.params.tid as string)
|
|
||||||
|
|
||||||
|
const tid = parseInt(route.params.tid as string)
|
||||||
const topicData = ref<TopicAside[]>()
|
const topicData = ref<TopicAside[]>()
|
||||||
|
const isEmpty = ref(false)
|
||||||
|
|
||||||
const fetchTopicData = async () => {
|
const fetchTopicData = async () => {
|
||||||
return (
|
return (
|
||||||
|
@ -28,6 +27,7 @@ const fetchTopicData = async () => {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
topicData.value = await fetchTopicData()
|
topicData.value = await fetchTopicData()
|
||||||
|
isEmpty.value = !topicData.value.length
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@ onMounted(async () => {
|
||||||
<div class="topic" v-for="(kun, index) in topicData" :key="index">
|
<div class="topic" v-for="(kun, index) in topicData" :key="index">
|
||||||
<RouterLink :to="`/topic/${kun.tid}`">{{ kun.title }}</RouterLink>
|
<RouterLink :to="`/topic/${kun.tid}`">{{ kun.title }}</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<span class="empty" v-if="isEmpty">
|
||||||
|
{{ $tm('topic.aside.tagsEmpty') }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -99,4 +103,15 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 17px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: oblique;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue